|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <image.hpp>
Public Member Functions | |
| virtual void | convertToDisplayFormat ()=0 |
| virtual void | free ()=0 |
| virtual int | getHeight () const =0 |
| virtual Color | getPixel (int x, int y)=0 |
| virtual int | getWidth () const =0 |
| Image (Image &&)=delete | |
| Image (Image const &)=delete | |
| Image & | operator= (Image &&)=delete |
| Image & | operator= (Image const &)=delete |
| virtual void | putPixel (int x, int y, Color const &color)=0 |
Static Public Member Functions | |
| static ImageLoader * | getImageLoader () |
| static Image * | load (std::string const &filename, bool convertToDisplayFormat=true) |
| static void | setImageLoader (ImageLoader *imageLoader) |
Static Protected Attributes | |
| static ImageLoader * | mImageLoader = nullptr |
Abstract holder for image data.
To be able to use this class you must first set an ImageLoader in Image by calling
The function is static. If this is not done, the constructor taking a filename will throw an exception. The ImageLoader you use must be compatible with the Graphics object you use.
|
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 fcn::opengl::Image, and fcn::sdl2::Image.
Referenced by load().
|
pure virtual |
Frees an image.
Implemented in fcn::opengl::Image, and fcn::sdl2::Image.
|
pure virtual |
Gets the height of the image.
Implemented in fcn::opengl::Image, and fcn::sdl2::Image.
Referenced by fcn::ImageButton::adjustSizeImpl(), and fcn::Graphics::drawImage().
|
static |
Gets the image loader used for loading images.
Definition at line 26 of file image.cpp.
References mImageLoader.
|
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 fcn::opengl::Image, and fcn::sdl2::Image.
|
pure virtual |
Gets the width of the image.
Implemented in fcn::opengl::Image, and fcn::sdl2::Image.
Referenced by fcn::CheckBox::adjustSizeImpl(), fcn::ImageButton::adjustSizeImpl(), fcn::Graphics::drawImage(), and fcn::CheckBox::drawMarkerImage().
|
static |
Loads an image by using the class' image loader.
All image loaders implemented in FifeGUI 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 31 of file image.cpp.
References convertToDisplayFormat(), and mImageLoader.
Referenced by fcn::CheckBox::setBackgroundImage(), fcn::Icon::setImage(), and fcn::ImageButton::setImage().
|
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 fcn::opengl::Image, and fcn::sdl2::Image.
|
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 21 of file image.cpp.
References mImageLoader.
|
staticprotected |
Holds the image loader to be used when loading images.
Definition at line 132 of file image.hpp.
Referenced by getImageLoader(), load(), and setImageLoader().