Image Class Reference
#include <image.h>
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 Image * | getSubImage (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.
|
Image * | merge (Image *image, int x, int y) |
| Merges two image SDL_Surfaces together.
|
Static Public Member Functions |
static Resource * | load (void *buffer, unsigned bufferSize) |
| Loads an image from a buffer in memory.
|
static Resource * | load (void *buffer, unsigned bufferSize, Dye const &dye) |
| Loads an image from a buffer in memory and recolors it.
|
static Image * | load (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] |
Image::Image |
( |
SDL_Surface * |
image |
) |
[protected] |
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
Member Data Documentation
The documentation for this class was generated from the following files: