Image Class Reference

#include <image.h>

Inheritance diagram for Image:

Resource SubImage

List of all members.


Detailed Description

Defines a class for loading and storing images.

Definition at line 48 of file image.h.


Public Member Functions

virtual ~Image ()
 Destructor.
virtual void unload ()
 Frees the resources created by SDL.
virtual int getWidth () const
 Returns the width of the image.
virtual int getHeight () const
 Returns the height of the image.
virtual ImagegetSubImage (int x, int y, int width, int height)
 Creates a new image with the desired clipping rectangle.
virtual void setAlpha (float alpha)
 Sets the alpha value of this image.
float getAlpha () const
 Returns the alpha value of this image.
Imagemerge (Image *image, int x, int y)
 Merges two image SDL_Surfaces together.

Static Public Member Functions

static Resourceload (void *buffer, unsigned bufferSize)
 Loads an image from a buffer in memory.
static Resourceload (void *buffer, unsigned bufferSize, Dye const &dye)
 Loads an image from a buffer in memory and recolors it.
static Imageload (SDL_Surface *)
 Loads an image from an SDL surface.

Protected Member Functions

 Image (SDL_Surface *image)
 Constructor.

Protected Attributes

SDL_Rect mBounds
bool mLoaded
SDL_Surface * mImage
float mAlpha

Friends

class Graphics

Constructor & Destructor Documentation

Image::~Image (  )  [virtual]

Destructor.

Definition at line 64 of file image.cpp.

Image::Image ( SDL_Surface *  image  )  [protected]

Constructor.

Definition at line 36 of file image.cpp.


Member Function Documentation

Resource * Image::load ( void *  buffer,
unsigned  bufferSize 
) [static]

Loads an image from a buffer in memory.

Parameters:
buffer The memory buffer containing the image data.
bufferSize The size of the memory buffer in bytes.
Returns:
NULL if an error occurred, a valid pointer otherwise.

Definition at line 69 of file image.cpp.

Resource * Image::load ( void *  buffer,
unsigned  bufferSize,
Dye const &  dye 
) [static]

Loads an image from a buffer in memory and recolors it.

Parameters:
buffer The memory buffer containing the image data.
bufferSize The size of the memory buffer in bytes.
dye The dye used to recolor the image.
Returns:
NULL if an error occurred, a valid pointer otherwise.

Definition at line 87 of file image.cpp.

Image * Image::load ( SDL_Surface *  tmpImage  )  [static]

Loads an image from an SDL surface.

Definition at line 130 of file image.cpp.

void Image::unload (  )  [virtual]

Frees the resources created by SDL.

Definition at line 272 of file image.cpp.

virtual int Image::getWidth ( void   )  const [inline, virtual]

Returns the width of the image.

Definition at line 98 of file image.h.

virtual int Image::getHeight ( void   )  const [inline, virtual]

Returns the height of the image.

Definition at line 104 of file image.h.

Image * Image::getSubImage ( int  x,
int  y,
int  width,
int  height 
) [virtual]

Creates a new image with the desired clipping rectangle.

Returns:
NULL if creation failed and a valid object otherwise.

Reimplemented in SubImage.

Definition at line 292 of file image.cpp.

void Image::setAlpha ( float  alpha  )  [virtual]

Sets the alpha value of this image.

Definition at line 304 of file image.cpp.

float Image::getAlpha (  )  const

Returns the alpha value of this image.

Definition at line 393 of file image.cpp.

Image * Image::merge ( Image image,
int  x,
int  y 
)

Merges two image SDL_Surfaces together.

This is for SDL use only, as reducing the number of surfaces that SDL has to render can cut down on the number of blit operations necessary, which in turn can help improve overall framerates. Don't use unless you are using it to reduce the number of overall layers that need to be drawn through SDL.

Definition at line 318 of file image.cpp.


Friends And Related Function Documentation

friend class Graphics [friend]

Definition at line 50 of file image.h.


Member Data Documentation

SDL_Rect Image::mBounds [protected]

Definition at line 161 of file image.h.

bool Image::mLoaded [protected]

Definition at line 162 of file image.h.

SDL_Surface* Image::mImage [protected]

Definition at line 172 of file image.h.

float Image::mAlpha [protected]

Definition at line 173 of file image.h.


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

Generated on Sun Apr 26 17:30:43 2009 for The Mana World by  doxygen 1.5.5