Go to the documentation of this file.
39 # define R_MASK 0x00ff0000
40 # define G_MASK 0x0000ff00
41 # define B_MASK 0x000000ff
42 # define A_MASK 0xff000000
44 # define R_MASK 0x000000ff
45 # define G_MASK 0x0000ff00
46 # define B_MASK 0x00ff0000
47 # define A_MASK 0xff000000
49 #define BYTES_PER_PIXEL 4
157 return alpha_channel_;
216 surface * target = NULL)
const;
229 draw (x, y, sx, sy, sl, sh, da_opt, target);
315 #ifdef __BIG_ENDIAN__
316 put_pix (x, y, map_color(b, SDL_ALPHA_OPAQUE, g, r));
318 put_pix (x, y, map_color(r, g, b, SDL_ALPHA_OPAQUE));
365 #ifdef __BIG_ENDIAN__
366 unmap_color(col, g, r, a, b);
368 unmap_color(col, r, g, b, a);
424 u_int8 bytes_per_pixel = BYTES_PER_PIXEL,
428 void * get_data (
u_int8 bytes_per_pixel,
437 void lock (SDL_Rect *rect)
const;
470 static SDL_Rect srcrect, dstrect;
Class where drawables can actually be drawn to.
u_int16 height() const
Returns the height of the drawable.
u_int32 BytesPerPixel
number of bytes used to represent the format
#define u_int32
32 bits long unsigned integer
SDL_Texture * Surface
the surface
void put_pix(u_int16 x, u_int16 y, u_int8 r, u_int8 g, u_int8 b)
Puts a pixel of a given color.
bool is_masked() const
Returns whether a surface is masked or not.
Abstract class for drawable objects manipulation.
#define u_int8
8 bits long unsigned integer
SDL_Surface * to_sw_surface(SDL_Rect *rect=NULL) const
Create a software surface backed by the (streaming) texture data.
void set_mask(bool m)
Sets the mask parameter of the surface.
#define s_int16
16 bits long signed integer
void get_pix_rgb(u_int16 x, u_int16 y, u_int8 r, u_int8 g, u_int8 b) const
Synonym of get_pix () to guarantee its access from Python.
void fillrect(s_int16 x, s_int16 y, u_int16 l, u_int16 h, u_int32 col, drawing_area *da_opt=NULL)
Fills an area of the surface with a given color.
virtual ~surface()
Destructor.
void set_scale(const u_int8 &scale)
Change the scale of the surface to the given value, resizing the internal texture appropriately.
void unlock() const
Unlock the surface after you've worked on it's pixels with the get_pix () and put_pix () methods.
u_int16 length() const
Returns the length of the drawable.
int Pitch
the pitch of the locked Surface
u_int8 scale_
current scale
void lock() const
Locks the surface.
u_int32 get_pix(u_int16 x, u_int16 y) const
Gets a pixel from the surface.
void * Pixels
the pixel data of the locked Surface
surface & operator=(const surface &src)
Surface copy (similar to copy ()).
s_int16 offset_x_
sub-pixel offset
bool has_alpha_channel() const
Returns whether the surface has an alpha channel.
void put_pix(u_int16 x, u_int16 y, u_int32 col)
Puts a pixel of a given color.
Implements "drawing zones" for drawing operations.
u_int8 scale() const
Get the surfaces current scaling factor.
void draw_part(s_int16 x, s_int16 y, s_int16 sx, s_int16 sy, u_int16 sl, u_int16 sh, const drawing_area *da_opt=NULL, surface *target=NULL) const
Synonym of draw () to guarantee its access from Python.
void clear()
Resets the surface to it's initial state, that is totally empty.
void set_alpha(u_int8 a, const bool &alpha_channel=false)
Sets the alpha value of the surface.
Declares the drawable class.
void resize(u_int16 l, u_int16 h)
Resize this surface.
#define u_int16
16 bits long unsigned integer
u_int8 alpha() const
Returns the alpha value of the surface.
surface(const u_int8 &scale=1)
Default constructor.
void draw(s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const
Draw the surface.
void copy(const surface &src)
Synonym of operator = to guarantee its access from Python.
u_int32 Format
the format of the surface
Screen access is made through this class.
void put_pix_rgb(u_int16 x, u_int16 y, u_int8 r, u_int8 g, u_int8 b)
Synonym of put_pix () to guarantee its access from Python.
void get_pix(u_int16 x, u_int16 y, u_int8 &r, u_int8 &g, u_int8 &b) const
Gets a pixel from a surface.