#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 might crash in a most bizarre way.
Definition at line 83 of file image.hpp.
Public Member Functions | |
| virtual void | convertToDisplayFormat ()=0 |
| Converts the image, if possible, to display format. | |
| virtual void | free ()=0 |
| Frees an 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 int | getWidth () const=0 |
| Gets the width of the image. | |
| Image () | |
| Constructor. | |
| virtual void | putPixel (int x, int y, const Color &color)=0 |
| Puts a pixel with a certain color at coordinate (x, y). | |
| virtual | ~Image () |
| Destructor. | |
Static Public Member Functions | |
| static ImageLoader * | getImageLoader () |
| Gets the image loader used for loading images. | |
| static Image * | load (const std::string &filename, bool convertToDisplayFormat=true) |
| Loads an image by using the class' image laoder. | |
| static void | setImageLoader (ImageLoader *imageLoader) |
| Sets the ImageLoader to be used for loading images. | |
Static Protected Attributes | |
| static ImageLoader * | mImageLoader = NULL |
| Holds the image loader to be used when loading images. | |
| 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::HGEImage, gcn::OpenGLImage, gcn::OpenLayerImage, and gcn::SDLImage.
Referenced by gcn::ImageFont::ImageFont(), gcn::SDLImageLoader::load(), gcn::OpenLayerImageLoader::load(), and gcn::AllegroImageLoader::load().
| virtual void gcn::Image::free | ( | ) | [pure virtual] |
Frees an image.
Implemented in gcn::AllegroImage, gcn::HGEImage, gcn::OpenGLImage, gcn::OpenLayerImage, and gcn::SDLImage.
| virtual int gcn::Image::getHeight | ( | ) | const [pure virtual] |
Gets the height of the image.
Implemented in gcn::AllegroImage, gcn::HGEImage, gcn::OpenGLImage, gcn::OpenLayerImage, and gcn::SDLImage.
Referenced by gcn::ImageButton::draw(), gcn::Icon::draw(), gcn::HGEGraphics::drawImage(), gcn::Graphics::drawImage(), gcn::Icon::Icon(), gcn::ImageButton::ImageButton(), gcn::ImageFont::ImageFont(), and gcn::ImageFont::scanForGlyph().
| ImageLoader * gcn::Image::getImageLoader | ( | ) | [static] |
Gets the image loader 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::HGEImage, gcn::OpenGLImage, gcn::OpenLayerImage, and gcn::SDLImage.
Referenced by gcn::ImageFont::ImageFont(), and gcn::ImageFont::scanForGlyph().
| virtual int gcn::Image::getWidth | ( | ) | const [pure virtual] |
Gets the width of the image.
Implemented in gcn::AllegroImage, gcn::HGEImage, gcn::OpenGLImage, gcn::OpenLayerImage, and gcn::SDLImage.
Referenced by gcn::ImageButton::draw(), gcn::Icon::draw(), gcn::HGEGraphics::drawImage(), gcn::Graphics::drawImage(), gcn::Icon::Icon(), gcn::ImageButton::ImageButton(), gcn::ImageFont::ImageFont(), and gcn::ImageFont::scanForGlyph().
| Image * gcn::Image::load | ( | const std::string & | filename, | |
| bool | convertToDisplayFormat = true | |||
| ) | [static] |
Loads an image by using the class' image laoder.
All image loaders implemented in Guichan return a newly instantiated image which must be deleted in order to avoid a memory leak.
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::Icon::Icon(), gcn::ImageButton::ImageButton(), and 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::HGEImage, gcn::OpenGLImage, gcn::OpenLayerImage, and gcn::SDLImage.
| void gcn::Image::setImageLoader | ( | ImageLoader * | imageLoader | ) | [static] |
Sets the ImageLoader to be used for loading images.
IMPORTANT: The image loader is static and MUST be set before loading images!
| imageLoader | The image loader to be used for loading images. |
Definition at line 79 of file image.cpp.
References mImageLoader.
1.5.2