Image manipulation class. More...
#include <image.h>
Public Member Functions | |
image () | |
Default constructor. | |
image (u_int16 l, u_int16 h, bool mode=true) | |
Creates an image with a specified size. | |
image (SDL_Surface *s, const SDL_Color &color) | |
Create image from SDL_Surface. | |
~image () | |
Destructor. | |
void | resize (u_int16 l, u_int16 h) |
Resize this image. | |
void | clear () |
Resets the image to it's initial state, that is totally empty. | |
image & | operator= (const image &src) |
Image copy (similar to copy ()). | |
void | copy (const image &src) |
Synonym of operator = to guarantee its access from Python. | |
Loading / Saving Methods. | |
s_int8 | get (igzstream &file) |
Loads an image from an opened file, saved in game internal format, with alpha and mask values. | |
s_int8 | load (string fname) |
Loads an image from a file name, in game internal format, with 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. | |
s_int8 | load_raw (string fname) |
Loads an image from a file name, in game internal format, without alpha and mask values. | |
s_int8 | get_pnm (SDL_RWops *file) |
Loads an image from an opened file, in PNM format, without alpha and mask values. | |
s_int8 | load_pnm (string fname) |
Loads an image from a file name, in PNM format, without alpha and mask values. | |
s_int8 | put (ogzstream &file) const |
Saves an image into an opened file, in game 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. | |
s_int8 | put_raw (ogzstream &file) const |
Saves an image into an opened file, in game format, without alpha and mask values. | |
s_int8 | save_raw (string fname) const |
Saves an image into an file, in game 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. | |
s_int8 | save_pnm (string fname) const |
Saves an image into an file, in PNM format, without alpha and mask values. | |
Special FX Methods. | |
void | zoom (const surface &src) |
Zooms a surface. | |
void | zoom (const surface &src, u_int16 l, u_int16 h, u_int16 x=0, u_int16 y=0) |
Zooms a surface. | |
void | zoom_to (const surface &src, u_int16 l, u_int16 h, u_int16 x=0, u_int16 y=0) |
Synonym of zoom () to guarantee its access from Python. | |
void | tile (const surface &src) |
Tiles a surface. | |
void | tile (const surface &src, u_int16 l, u_int16 h, u_int16 x=0, u_int16 y=0) |
Tiles a surface. | |
void | tile_to (const surface &src, u_int16 l, u_int16 h, u_int16 x=0, u_int16 y=0) |
Synonym of tile () to guarantee its access from Python. | |
void | brightness (const surface &src, u_int8 cont, bool proceed_mask=false) |
Applies a "brightness" to a surface. |
Image manipulation class.
Designed to work with single images, without having to care about the bit depth. This class is widely used through the game - in fact it handles everything that is displayed on the screen. This class highly relies on surface, so you'll probably want to have a look at it before using image.
Definition at line 41 of file image.h.
image::image | ( | ) |
image::image | ( | u_int16 | l, | |
u_int16 | h, | |||
bool | mode = true | |||
) |
image::image | ( | SDL_Surface * | s, | |
const SDL_Color & | color | |||
) |
void image::resize | ( | u_int16 | l, | |
u_int16 | h | |||
) |
void image::clear | ( | ) |
s_int8 image::get | ( | igzstream & | file | ) |
s_int8 image::load | ( | string | fname | ) |
s_int8 image::get_raw | ( | igzstream & | file | ) |
s_int8 image::load_raw | ( | string | fname | ) |
s_int8 image::get_pnm | ( | SDL_RWops * | file | ) |
s_int8 image::load_pnm | ( | string | fname | ) |
s_int8 image::put | ( | ogzstream & | file | ) | const |
Saves an image into an opened file, in game format, with alpha and mask values.
file | opened file where to save into. |
s_int8 image::save | ( | string | fname | ) | const |
Saves an image into an file, in game format, with alpha and mask values.
fname | file name where to save into. |
s_int8 image::put_raw | ( | ogzstream & | file | ) | const |
Saves an image into an opened file, in game format, without alpha and mask values.
file | opened file where to save into. |
s_int8 image::save_raw | ( | string | fname | ) | const |
Saves an image into an file, in game format, without alpha and mask values.
fname | file name where to save into. |
s_int8 image::put_pnm | ( | SDL_RWops * | file | ) | const |
Saves an image into an opened file, in PNM format, without alpha and mask values.
file | opened file where to save into. |
s_int8 image::save_pnm | ( | string | fname | ) | const |
Saves an image into an file, in PNM format, without alpha and mask values.
fname | file name where to save into. |
void image::zoom | ( | const surface & | src | ) | [inline] |
void image::zoom | ( | const surface & | src, | |
u_int16 | l, | |||
u_int16 | h, | |||
u_int16 | x = 0 , |
|||
u_int16 | y = 0 | |||
) |
Zooms a surface.
Zoom the content of the src surface into this image, to the size (l, h), at position (x, y) on this image.
src | The source surface to zoom. | |
l | length of the zoomed image. | |
h | height of the zoomed image. | |
x | X offset on the destination image. | |
y | Y offset on the destination image. |
void image::zoom_to | ( | const surface & | src, | |
u_int16 | l, | |||
u_int16 | h, | |||
u_int16 | x = 0 , |
|||
u_int16 | y = 0 | |||
) | [inline] |
void image::tile | ( | const surface & | src | ) | [inline] |
void image::tile | ( | const surface & | src, | |
u_int16 | l, | |||
u_int16 | h, | |||
u_int16 | x = 0 , |
|||
u_int16 | y = 0 | |||
) |
Tiles a surface.
Tiles the src surface so the area of this image starting at position (x, y) and (l, h) sized is totally filled.
source | the source surface to tile. | |
l | length of the area to tile. | |
h | height of the area to tile. | |
x | X offset on the destination image. | |
y | Y offset on the destination image. |
void image::tile_to | ( | const surface & | src, | |
u_int16 | l, | |||
u_int16 | h, | |||
u_int16 | x = 0 , |
|||
u_int16 | y = 0 | |||
) | [inline] |
void image::brightness | ( | const surface & | src, | |
u_int8 | cont, | |||
bool | proceed_mask = false | |||
) |
Applies a "brightness" to a surface.
Lighten (or darken) the src surface and put the result into this image. This image will be resized to the src surface's size.
src | the source surface to lighten/darken. | |
cont | the "brightness" value, if < 256 the image will be darkened. |
proceed_mask | if set to true, then the translucent pixels will be lightened/darkened too. |
void image::copy | ( | const image & | src | ) | [inline] |