image Class Reference

Image manipulation class. More...

#include <image.h>

Inheritance diagram for image:

Inheritance graph
[legend]
Collaboration diagram for image:

Collaboration graph
[legend]

List of all members.

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.
imageoperator= (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.
These methods allows you to load and save an image in different formats.

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.
Allows you to put fantasy in your image manipulations! Can eventually even be usefull.

..

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.


Detailed Description

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.


Constructor & Destructor Documentation

image::image (  ) 

Default constructor.

The image created via this constructor is totally empty.

Definition at line 43 of file image.cc.

image::image ( u_int16  l,
u_int16  h,
bool  mode = true 
)

Creates an image with a specified size.

Parameters:
l length of the image.
h height of the image.
mode use screen::dblmode or set dbl_mode to false
Attention:
Not accessible from Python.

Definition at line 47 of file image.cc.

image::image ( SDL_Surface *  s,
const SDL_Color &  color 
)

Create image from SDL_Surface.

Parameters:
s surface

Definition at line 52 of file image.cc.

image::~image (  ) 

Destructor.

Definition at line 69 of file image.cc.


Member Function Documentation

void image::resize ( u_int16  l,
u_int16  h 
)

Resize this image.

All the content will be lost. If you want to zoom the image you'll want to see the zoom () function instead.

Parameters:
l new length.
h new height.
See also:
zoom ()

Reimplemented from surface.

Definition at line 73 of file image.cc.

void image::clear (  ) 

Resets the image to it's initial state, that is totally empty.

Reimplemented from surface.

Definition at line 78 of file image.cc.

s_int8 image::get ( igzstream file  ) 

Loads an image from an opened file, saved in game internal format, with alpha and mask values.

Parameters:
file the opened file from which to read.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
load ()

Definition at line 83 of file image.cc.

s_int8 image::load ( string  fname  ) 

Loads an image from a file name, in game internal format, with alpha and mask values.

Parameters:
fname the name of the file to load.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
get ()

Definition at line 102 of file image.cc.

s_int8 image::get_raw ( igzstream file  ) 

Loads an image from an opened file, saved in game internal format, without alpha and mask values.

Parameters:
file the opened file from which to read.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
load_raw ()

Definition at line 114 of file image.cc.

s_int8 image::load_raw ( string  fname  ) 

Loads an image from a file name, in game internal format, without alpha and mask values.

Parameters:
fname the name of the file to load.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
get_raw ()

Definition at line 139 of file image.cc.

s_int8 image::get_pnm ( SDL_RWops *  file  ) 

Loads an image from an opened file, in PNM format, without alpha and mask values.

Parameters:
file the opened file from which to read.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
load_pnm ()

Definition at line 152 of file image.cc.

s_int8 image::load_pnm ( string  fname  ) 

Loads an image from a file name, in PNM format, without alpha and mask values.

Parameters:
fname the name of the file to load.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
get_pnm ()

Definition at line 172 of file image.cc.

s_int8 image::put ( ogzstream file  )  const

Saves an image into an opened file, in game format, with alpha and mask values.

Warning:
as the image which is saved comes from a screen's depth surface, it will be slightly altered during the save. If you want a class capable of saving images with full truecolor quality, use image_edit instead.
Parameters:
file opened file where to save into.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
save ()

Definition at line 185 of file image.cc.

s_int8 image::save ( string  fname  )  const

Saves an image into an file, in game format, with alpha and mask values.

Warning:
as the image which is saved comes from a screen's depth surface, it will be slightly altered during the save. If you want a class capable of saving images with full truecolor quality, use image_edit instead.
Parameters:
fname file name where to save into.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
put ()

Definition at line 198 of file image.cc.

s_int8 image::put_raw ( ogzstream file  )  const

Saves an image into an opened file, in game format, without alpha and mask values.

Warning:
as the image which is saved comes from a screen's depth surface, it will be slightly altered during the save. If you want a class capable of saving images with full truecolor quality, use image_edit instead.
Parameters:
file opened file where to save into.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
save_raw ()

Definition at line 210 of file image.cc.

s_int8 image::save_raw ( string  fname  )  const

Saves an image into an file, in game format, without alpha and mask values.

Warning:
as the image which is saved comes from a screen's depth surface, it will be slightly altered during the save. If you want a class capable of saving images with full truecolor quality, use image_edit instead.
Parameters:
fname file name where to save into.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
put_raw ()

Definition at line 254 of file image.cc.

s_int8 image::put_pnm ( SDL_RWops *  file  )  const

Saves an image into an opened file, in PNM format, without alpha and mask values.

Warning:
as the image which is saved comes from a screen's depth surface, it will be slightly altered during the save. If you want a class capable of saving images with full truecolor quality, use image_edit instead.
Parameters:
file opened file where to save into.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
save_pnm ()

Definition at line 266 of file image.cc.

s_int8 image::save_pnm ( string  fname  )  const

Saves an image into an file, in PNM format, without alpha and mask values.

Warning:
as the image which is saved comes from a screen's depth surface, it will be slightly altered during the save. If you want a class capable of saving images with full truecolor quality, use image_edit instead.
Parameters:
fname file name where to save into.
Returns:
  • 0 in case of success.
  • -1 in case of error.
See also:
put_pnm ()

Definition at line 293 of file image.cc.

void image::zoom ( const surface src  )  [inline]

Zooms a surface.

Zoom the content of the src surface into this image, to it's own size.

Parameters:
src the source image to zoom.

Definition at line 261 of file image.h.

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.

Parameters:
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.
Attention:
Not available from Python. Use zoom_to () from Python instead.
See also:
zoom_to ()

Definition at line 306 of file image.cc.

void image::zoom_to ( const surface src,
u_int16  l,
u_int16  h,
u_int16  x = 0,
u_int16  y = 0 
) [inline]

Synonym of zoom () to guarantee its access from Python.

See also:
zoom ()

Definition at line 290 of file image.h.

void image::tile ( const surface src  )  [inline]

Tiles a surface.

Tiles the src surface so this image is totally filled.

Parameters:
source the source surface to tile.

Definition at line 299 of file image.h.

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.

Parameters:
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.
Attention:
Not available from Python. Use tile_to () from Python instead.
See also:
tile_to ()

Definition at line 340 of file image.cc.

void image::tile_to ( const surface src,
u_int16  l,
u_int16  h,
u_int16  x = 0,
u_int16  y = 0 
) [inline]

Synonym of tile () to guarantee its access from Python.

See also:
tile ()

Definition at line 327 of file image.h.

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.

Parameters:
src the source surface to lighten/darken.
cont the "brightness" value, if < 256 the image will be darkened.
Todo:
modify it so when < 128 -> darken, > 128 -> brighten.
Parameters:
proceed_mask if set to true, then the translucent pixels will be lightened/darkened too.

Definition at line 352 of file image.cc.

image & image::operator= ( const image src  ) 

Image copy (similar to copy ()).

Attention:
Not available from Python. Use copy () from Python instead.
See also:
copy ()

Definition at line 384 of file image.cc.

void image::copy ( const image src  )  [inline]

Synonym of operator = to guarantee its access from Python.

See also:
operator =

Definition at line 362 of file image.h.


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

Generated on Wed Jun 18 16:55:34 2008 for Adonthell by  doxygen 1.5.6