50 SDL_SetColorKey (s, 1, SDL_MapRGB (s->format, color.r, color.g, color.b));
51 SDL_BlitSurface (s, NULL, dest, NULL);
55 SDL_FreeSurface (dest);
115 rawdata =
new char[l * h * 3];
118 raw2display (rawdata, l, h);
120 delete[] (
char *) rawdata;
135 std::cout <<
"cannot find file " << fname << std::endl;
153 raw2display (rawdata, l, h);
168 file = SDL_RWFromFile (fname.c_str (),
"rb");
171 std::cout <<
"cannot find file " << fname << std::endl;
211 void *rawdata = get_data(3, R_MASK, G_MASK, B_MASK, 0);
232 void *rawdata = get_data(3, R_MASK, G_MASK, B_MASK, 0);
244 file = SDL_RWFromFile (fname.c_str (),
"wb");
271 for (j = y; j < h + y; j++)
274 for (i = x; i < l + x; i++)
293 for (posy = 0; posy < h; posy += src.
height ())
294 for (posx = 0; posx < l; posx += src.
length ())
295 src.
draw (x + posx, y + posy, &da,
this);
313 for (j = 0; j < real_height; j++)
314 for (i = 0; i < real_length; i++)
319 unmap_color (temp, ir, ig, ib, ia);
320 ir = (ir * cont) >> 8;
321 ig = (ig * cont) >> 8;
322 ib = (ib * cont) >> 8;
323 temp = map_color(ir, ig, ib, ia);
346 set_data(rawdata, l, h, 3, R_MASK, G_MASK, B_MASK, 0);
s_int8 get_pnm(SDL_RWops *file)
Loads an image from an opened file, in PNM format, without alpha and mask values. ...
Class to write data from a Gzip compressed file.
void close()
Close the file that was opened.
SDL_Texture * Surface
the surface
u_int16 height() const
Returns the height of the drawable.
Class to read data from a Gzip compressed file.
void resize(u_int16 l, u_int16 h)
Resize this image.
#define u_int16
16 bits long unsigned integer
virtual ~image()
Destructor.
s_int8 load(string fname)
Loads an image from a file name, in game internal format, with alpha and mask values.
u_int16 length() const
Returns the length of the drawable.
Class where drawables can actually be drawn to.
u_int8 scale() const
Get the surfaces current scaling factor.
static void put(SDL_RWops *file, void *image, u_int16 length, u_int16 height)
Saves a PNM image into an opened file.
Image manipulation class.
#define u_int32
32 bits long unsigned integer
#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.
static u_int8 scale()
Scale factor of the screen.
void resize(u_int16 l, u_int16 h)
Resize this surface.
s_int8 save_raw(string fname) const
Saves an image into an file, in game format, without alpha and mask values.
image()
Default constructor.
void tile(const surface &src)
Tiles a surface.
Declares the image class.
void clear()
Resets the image to it's initial state, that is totally empty.
s_int8 load_raw(string fname)
Loads an image from a file name, in game internal format, without alpha and mask values.
void clear()
Resets the surface to it's initial state, that is totally empty.
bool is_open()
Returns whether the file is opened or not.
Implements "drawing zones" for drawing operations.
image & operator=(const image &src)
Image copy (similar to copy ()).
s_int8 put(ogzstream &file) const
Saves an image into an opened file, in game format, with alpha and mask values.
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.
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...
void zoom(const surface &src)
Zooms a surface.
s_int8 get(igzstream &file)
Loads an image from an opened file, saved in game internal format, with alpha and mask values...
s_int8 save(string fname) const
Saves an image into an file, in game format, with alpha and mask values.
Declares the pnm static class.
bool is_masked() const
Returns whether a surface is masked or not.
s_int8 save_pnm(string fname) const
Saves an image into an file, in PNM format, without alpha and mask values.
s_int8 put_pnm(SDL_RWops *file) const
Saves an image into an opened file, in PNM format, without alpha and mask values. ...
void brightness(const surface &src, u_int8 cont, bool proceed_mask=false)
Applies a "brightness" to a surface.
void lock() const
Locks the surface.
s_int8 load_pnm(string fname)
Loads an image from a file name, in PNM format, without alpha and mask values.
s_int8 get_raw(igzstream &file)
Loads an image from an opened file, saved in game internal format, without alpha and mask values...
static void * get(SDL_RWops *file, u_int16 *length, u_int16 *height)
Reads a PNM image from an opened file.
static u_int32 trans_col()
Returns the translucent color in screen's depth format.
#define s_int8
8 bits long signed integer
void set_mask(bool m)
Sets the mask parameter of the surface.
void get_block(void *to, u_int32 size)
Reads a block of bytes from the file.
u_int8 alpha() const
Returns the alpha value of the surface.
s_int8 put_raw(ogzstream &file) const
Saves an image into an opened file, in game format, without alpha and mask values.
void draw(s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const
Draw the surface.
void put_block(void *to, u_int32 size)
Writes a block of bytes to the file.
void put_pix(u_int16 x, u_int16 y, u_int32 col)
Puts a pixel of a given color.
SDL_Surface * to_sw_surface(SDL_Rect *rect=NULL) const
Create a software surface backed by the (streaming) texture data.