#include <image.hpp>
Inheritance diagram for gcn::Image:
To be able to use this class you must first set an ImageLoader in Image by calling
Image::setImageLoader(myImageLoader)
EXAMPLE: If you use SDLGraphics you should use SDLImageLoader. Otherwise your program will crash in a most bizarre way.
Definition at line 80 of file image.hpp.
Public Member Functions | |
Image () | |
Constructor. | |
virtual | ~Image () |
Destructor. | |
virtual void | free ()=0 |
Frees an image. | |
virtual int | getWidth () const =0 |
Gets the width of the Image. | |
virtual int | getHeight () const =0 |
Gets the height of the Image. | |
virtual Color | getPixel (int x, int y)=0 |
Gets the color of a pixel at coordinate (x, y) in the image. | |
virtual void | putPixel (int x, int y, const Color &color)=0 |
Puts a pixel with a certain color at coordinate (x, y). | |
virtual void | convertToDisplayFormat ()=0 |
Converts the image, if possible, to display format. | |
Static Public Member Functions | |
static Image * | load (const std::string &filename, bool convertToDisplayFormat=true) |
Loads an image by calling the Image class' ImageLoader. | |
static ImageLoader * | getImageLoader () |
Gets the ImageLoader used for loading Images. | |
static void | setImageLoader (ImageLoader *imageLoader) |
Sets the ImageLoader to be used for loading images. | |
Static Protected Attributes | |
static ImageLoader * | mImageLoader = NULL |
virtual void gcn::Image::convertToDisplayFormat | ( | ) | [pure virtual] |
Converts the image, if possible, to display format.
IMPORTANT: Only guaranteed to work before the image has been converted to display format.
Implemented in gcn::AllegroImage, gcn::OpenGLImage, and gcn::SDLImage.
Referenced by gcn::ImageFont::ImageFont(), gcn::SDLImageLoader::load(), and gcn::AllegroImageLoader::load().
virtual int gcn::Image::getHeight | ( | ) | const [pure virtual] |
Gets the height of the Image.
Implemented in gcn::AllegroImage, gcn::OpenGLImage, and gcn::SDLImage.
Referenced by gcn::ImageFont::addGlyph(), gcn::Graphics::drawImage(), gcn::Icon::Icon(), and gcn::ImageFont::ImageFont().
ImageLoader * gcn::Image::getImageLoader | ( | ) | [static] |
Gets the ImageLoader used for loading Images.
Definition at line 84 of file image.cpp.
References mImageLoader.
virtual Color gcn::Image::getPixel | ( | int | x, | |
int | y | |||
) | [pure virtual] |
Gets the color of a pixel at coordinate (x, y) in the image.
IMPORTANT: Only guaranteed to work before the image has been converted to display format.
x | the x coordinate. | |
y | the y coordinate. |
Implemented in gcn::AllegroImage, gcn::OpenGLImage, and gcn::SDLImage.
Referenced by gcn::ImageFont::addGlyph(), and gcn::ImageFont::ImageFont().
virtual int gcn::Image::getWidth | ( | ) | const [pure virtual] |
Gets the width of the Image.
Implemented in gcn::AllegroImage, gcn::OpenGLImage, and gcn::SDLImage.
Referenced by gcn::ImageFont::addGlyph(), gcn::Graphics::drawImage(), gcn::Icon::Icon(), and gcn::ImageFont::ImageFont().
Image * gcn::Image::load | ( | const std::string & | filename, | |
bool | convertToDisplayFormat = true | |||
) | [static] |
Loads an image by calling the Image class' ImageLoader.
NOTE: The functions getPixel and putPixel are only guaranteed to work before an image has been converted to display format.
filename | the file to load. | |
convertToDisplayFormat | true if the image should be converted to display, false otherwise. |
Definition at line 89 of file image.cpp.
References gcn::ImageLoader::load(), and mImageLoader.
Referenced by gcn::ImageFont::ImageFont().
virtual void gcn::Image::putPixel | ( | int | x, | |
int | y, | |||
const Color & | color | |||
) | [pure virtual] |
Puts a pixel with a certain color at coordinate (x, y).
x | the x coordinate. | |
y | the y coordinate. | |
color | the color of the pixel to put. |
Implemented in gcn::AllegroImage, gcn::OpenGLImage, and gcn::SDLImage.
void gcn::Image::setImageLoader | ( | ImageLoader * | imageLoader | ) | [static] |
Sets the ImageLoader to be used for loading images.
IMPORTANT: The ImageLoader is static and MUST be set before loading images!
imageLoader | the ImageLoader to be used for loading images. |
Definition at line 79 of file image.cpp.
References mImageLoader.