|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <image.hpp>
Public Member Functions | |
| void | convertToDisplayFormat () override |
| void | free () override |
| int | getHeight () const override |
| Color | getPixel (int x, int y) override |
| virtual SDL_Surface * | getSurface () const |
| virtual SDL_Texture * | getTexture () const |
| int | getWidth () const override |
| Image (Image &&)=delete | |
| Image (Image const &)=delete | |
| Image (SDL_Surface *surface, bool autoFree, SDL_Renderer *renderer=nullptr) | |
| Image & | operator= (Image &&)=delete |
| Image & | operator= (Image const &)=delete |
| void | putPixel (int x, int y, Color const &color) override |
| Public Member Functions inherited from fcn::Image | |
| Image (Image &&)=delete | |
| Image (Image const &)=delete | |
| Image & | operator= (Image &&)=delete |
| Image & | operator= (Image const &)=delete |
Protected Attributes | |
| bool | mAutoFree |
| SDL_Renderer * | mRenderer = nullptr |
| SDL_Texture * | mTexture = nullptr |
| SDL_Surface * | mTransientSurface = nullptr |
Additional Inherited Members | |
| Static Public Member Functions inherited from fcn::Image | |
| static ImageLoader * | getImageLoader () |
| static Image * | load (std::string const &filename, bool convertToDisplayFormat=true) |
| static void | setImageLoader (ImageLoader *imageLoader) |
| Static Protected Attributes inherited from fcn::Image | |
| static ImageLoader * | mImageLoader = nullptr |
SDL2-specific implementation of Image.
Definition at line 23 of file backends/sdl2/image.hpp.
| fcn::sdl2::Image::Image | ( | SDL_Surface * | surface, |
| bool | autoFree, | ||
| SDL_Renderer * | renderer = nullptr ) |
Constructor.
Load an image from an SDL surface.
NOTE: The functions getPixel and putPixel are only guaranteed to work before an image has been converted to display format.
| surface | the surface from which to load. |
| autoFree | true if the surface should automatically be deleted. |
| renderer | the renderer to use for creating the texture. |
Definition at line 18 of file backends/sdl2/image.cpp.
References mAutoFree, mRenderer, mTexture, and mTransientSurface.
|
overridevirtual |
Reimplemented from fcn::Image.
Definition at line 100 of file backends/sdl2/image.cpp.
|
overridevirtual |
Converts the image, if possible, to display format.
IMPORTANT: Only guaranteed to work before the image has been converted to display format.
Implements fcn::Image.
Definition at line 162 of file backends/sdl2/image.cpp.
References mTexture.
Referenced by fcn::sdl2::ImageLoader::load().
|
overridevirtual |
Frees an image.
Implements fcn::Image.
Definition at line 169 of file backends/sdl2/image.cpp.
References mTexture, and mTransientSurface.
|
overridevirtual |
Gets the height of the image.
Implements fcn::Image.
Definition at line 132 of file backends/sdl2/image.cpp.
References mTexture.
|
overridevirtual |
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. |
Implements fcn::Image.
Definition at line 144 of file backends/sdl2/image.cpp.
References mTransientSurface, and fcn::sdl2::SDLgetPixel().
|
virtual |
Gets the SDL surface for the image.
Definition at line 110 of file backends/sdl2/image.cpp.
References mTransientSurface.
|
virtual |
Gets the SDL texture for the image.
Definition at line 115 of file backends/sdl2/image.cpp.
References mTexture.
Referenced by fcn::sdl2::Graphics::drawImage().
|
overridevirtual |
Gets the width of the image.
Implements fcn::Image.
Definition at line 120 of file backends/sdl2/image.cpp.
References mTexture.
|
overridevirtual |
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. |
Implements fcn::Image.
Definition at line 153 of file backends/sdl2/image.cpp.
References mTransientSurface, and fcn::sdl2::SDLputPixel().
|
protected |
Whether the transient surface should be freed on destruction.
Definition at line 85 of file backends/sdl2/image.hpp.
Referenced by Image().
|
protected |
SDL renderer associated with the texture.
Definition at line 79 of file backends/sdl2/image.hpp.
Referenced by Image().
|
protected |
SDL texture for accelerated rendering (primary storage).
Definition at line 76 of file backends/sdl2/image.hpp.
Referenced by convertToDisplayFormat(), free(), getHeight(), getTexture(), getWidth(), and Image().
|
protected |
Transient surface for pixel operations (getPixel/putPixel).
Definition at line 82 of file backends/sdl2/image.hpp.
Referenced by free(), getPixel(), getSurface(), Image(), and putPixel().