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;
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.
bool has_alpha_channel() const
Returns whether the surface has an alpha channel.
SDL_Texture * Surface
the surface
u_int16 height() const
Returns the height of the drawable.
#define u_int16
16 bits long unsigned integer
u_int32 BytesPerPixel
number of bytes used to represent the format
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.
u_int16 length() const
Returns the length of the drawable.
Class where drawables can actually be drawn to.
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.
u_int8 scale_
current scale
u_int8 scale() const
Get the surfaces current scaling factor.
#define u_int32
32 bits long unsigned integer
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.
#define u_int8
8 bits long unsigned integer
u_int32 get_pix(u_int16 x, u_int16 y) const
Gets a pixel from the surface.
void resize(u_int16 l, u_int16 h)
Resize this surface.
int Pitch
the pitch of the locked Surface
Declares the drawable class.
void clear()
Resets the surface to it's initial state, that is totally empty.
Implements "drawing zones" for drawing operations.
void * Pixels
the pixel data of the locked Surface
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.
Screen access is made through this class.
void set_alpha(u_int8 a, const bool &alpha_channel=false)
Sets the alpha value of the surface.
#define s_int16
16 bits long signed integer
void unlock() const
Unlock the surface after you've worked on it's pixels with the get_pix () and put_pix () methods...
void set_scale(const u_int8 &scale)
Change the scale of the surface to the given value, resizing the internal texture appropriately...
surface & operator=(const surface &src)
Surface copy (similar to copy ()).
s_int16 offset_x_
sub-pixel offset
bool is_masked() const
Returns whether a surface is masked or not.
u_int32 Format
the format of the surface
Abstract class for drawable objects manipulation.
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 lock() const
Locks the surface.
surface(const u_int8 &scale=1)
Default constructor.
void set_mask(bool m)
Sets the mask parameter of the surface.
virtual ~surface()
Destructor.
u_int8 alpha() const
Returns the alpha value of the surface.
void draw(s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const
Draw the surface.
void put_pix(u_int16 x, u_int16 y, u_int32 col)
Puts a pixel of a given color.
void copy(const surface &src)
Synonym of operator = to guarantee its access from Python.
SDL_Surface * to_sw_surface(SDL_Rect *rect=NULL) const
Create a software surface backed by the (streaming) texture data.