Adonthell  0.4
drawing_area Class Reference

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

#include <drawing_area.h>

Inheritance diagram for drawing_area:

Public Member Functions

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

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 54 of file drawing_area.h.

Constructor & Destructor Documentation

◆ drawing_area() [1/2]

drawing_area::drawing_area ( )

Default constructor.

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

Definition at line 31 of file drawing_area.cc.

◆ drawing_area() [2/2]

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

Builds a drawing_area from the parameters.

Parameters
pxX position.
pyY position.
pwLength.
phHeight.
Note
Not available from Python.

Definition at line 38 of file drawing_area.cc.

Member Function Documentation

◆ x()

s_int16 drawing_area::x ( ) const
inline

Returns the horizontal position of the drawing_area.

Returns
horizontal position of the drawing_area.

Definition at line 77 of file drawing_area.h.

◆ y()

s_int16 drawing_area::y ( ) const
inline

Returns the vertical position of the drawing_area.

Returns
vertical position of the drawing_area.

Definition at line 85 of file drawing_area.h.

◆ length()

u_int16 drawing_area::length ( ) const
inline

Returns the length of the drawing_area.

Returns
length of the drawing_area.

Definition at line 93 of file drawing_area.h.

◆ height()

u_int16 drawing_area::height ( ) const
inline

Returns the height of the drawing_area.

Returns
height of the drawing_area.

Definition at line 101 of file drawing_area.h.

◆ move()

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

Move the drawing_area.

Parameters
nxnew horizontal position.
nynew vertical position.

Definition at line 110 of file drawing_area.h.

◆ resize()

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

Resize the drawing_area.

Parameters
nlnew length.
nlnew height.

Definition at line 120 of file drawing_area.h.

◆ assign_drawing_area()

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
dathe drawing_area to assign.

Definition at line 131 of file drawing_area.h.

◆ assigned_drawing_area()

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 142 of file drawing_area.h.

◆ detach_drawing_area()

void drawing_area::detach_drawing_area ( )
inline

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

Definition at line 150 of file drawing_area.h.

◆ operator=()

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

Convert an SDL_Rect into a drawing_area.

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

Definition at line 45 of file drawing_area.cc.

◆ setup_rects()

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 52 of file drawing_area.cc.


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