drawing_area Class Reference

Implements "drawing zones" for drawing operations. More...

#include <drawing_area.h>

Inheritance diagram for drawing_area:

Inheritance graph
[legend]
Collaboration diagram for drawing_area:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 drawing_area ()
 Default constructor.
 drawing_area (s_int16 px, s_int16 py, u_int16 pw, u_int16 ph)
 Builds a drawing_area from the parameters.
s_int16 x () const
 Returns the horizontal position of the drawing_area.
s_int16 y () const
 Returns the vertical position of the drawing_area.
u_int16 length () const
 Returns the length of the drawing_area.
u_int16 height () const
 Returns the height of the drawing_area.
void move (s_int16 nx, s_int16 ny)
 Move the drawing_area.
void resize (u_int16 nl, u_int16 nh)
 Resize the drawing_area.
void assign_drawing_area (const drawing_area *da)
 Assign a drawing_area to this drawing_area.
drawing_areaassigned_drawing_area () const
 Returns a pointer to the drawing_area assigned to this one.
void detach_drawing_area ()
 Detach (if needed) the drawing_area which was attached to this one.
drawing_areaoperator= (SDL_Rect &r)
 Convert an SDL_Rect into a drawing_area.
SDL_Rect setup_rects () const
 Gets the real parameters of this drawing_area.


Detailed Description

Implements "drawing zones" for drawing operations.

An object which is drawn into a drawing_area will only appear in the rectangular zone it covers. During some drawing operations, you may want to limit the blits to a limited area of the screen. For example, if you want to draw an image into a window, and that image is larger than this window, you don't want the entire image to appear, only the part that fits into the window. This is exactly what drawing areas are for. A drawing area is a square that can be any size and located anywhere on the screen. If you assign a drawing area to a drawable object (for example, an image), and then draw the image on the screen, the part of the image that doesn't fit the drawing area limits isn't displayed. A drawing area can be assigned to any drawable, but also to another drawing area, in which case the result of blitting operations from objects that are assigned to the second drawing area will be limited to the intersection of the two drawing areas. Recursively, you can use as many drawing_areas as you wish for drawing operations.

Definition at line 50 of file drawing_area.h.


Constructor & Destructor Documentation

drawing_area::drawing_area (  ) 

Default constructor.

The drawing_area is then located at (0, 0) and is (0, 0) sized.

Definition at line 30 of file drawing_area.cc.

drawing_area::drawing_area ( s_int16  px,
s_int16  py,
u_int16  pw,
u_int16  ph 
)

Builds a drawing_area from the parameters.

Parameters:
px X position.
py Y position.
pw Length.
ph Height.
Note:
Not available from Python.

Definition at line 37 of file drawing_area.cc.


Member Function Documentation

s_int16 drawing_area::x (  )  const [inline]

Returns the horizontal position of the drawing_area.

Returns:
horizontal position of the drawing_area.

Reimplemented in win_base.

Definition at line 73 of file drawing_area.h.

s_int16 drawing_area::y (  )  const [inline]

Returns the vertical position of the drawing_area.

Returns:
vertical position of the drawing_area.

Reimplemented in win_base.

Definition at line 81 of file drawing_area.h.

u_int16 drawing_area::length (  )  const [inline]

Returns the length of the drawing_area.

Returns:
length of the drawing_area.

Definition at line 89 of file drawing_area.h.

u_int16 drawing_area::height (  )  const [inline]

Returns the height of the drawing_area.

Returns:
height of the drawing_area.

Definition at line 97 of file drawing_area.h.

void drawing_area::move ( s_int16  nx,
s_int16  ny 
) [inline]

Move the drawing_area.

Parameters:
nx new horizontal position.
ny new vertical position.

Reimplemented in win_base.

Definition at line 106 of file drawing_area.h.

void drawing_area::resize ( u_int16  nl,
u_int16  nh 
) [inline]

Resize the drawing_area.

Parameters:
nl new length.
nl new height.

Reimplemented in win_base.

Definition at line 116 of file drawing_area.h.

void drawing_area::assign_drawing_area ( const drawing_area da  )  [inline]

Assign a drawing_area to this drawing_area.

If a drawing area is assigned to another one, the zone covered by the drawing_area is the intersection of the two.

Parameters:
da the drawing_area to assign.

Definition at line 127 of file drawing_area.h.

drawing_area* drawing_area::assigned_drawing_area (  )  const [inline]

Returns a pointer to the drawing_area assigned to this one.

Returns:
pointer to the assigned drawing_area, NULL if none.

Definition at line 138 of file drawing_area.h.

void drawing_area::detach_drawing_area (  )  [inline]

Detach (if needed) the drawing_area which was attached to this one.

Definition at line 146 of file drawing_area.h.

drawing_area & drawing_area::operator= ( SDL_Rect &  r  ) 

Convert an SDL_Rect into a drawing_area.

Parameters:
r SDL_rect to convert.
Returns:
drawing_area which has the same dimensions and location as r.

Definition at line 44 of file drawing_area.cc.

SDL_Rect drawing_area::setup_rects (  )  const

Gets the real parameters of this drawing_area.

Returns:
SDL_Rect which is the intersection of this drawing area and all the drawing areas assigned to it.

Definition at line 51 of file drawing_area.cc.


The documentation for this class was generated from the following files:

Generated on Tue Aug 11 15:31:45 2009 for Adonthell by  doxygen 1.5.9