|
FifeGUI 0.3.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 GLuint | getTextureHandle () const |
| virtual int | getTextureHeight () const |
| virtual int | getTextureWidth () const |
| int | getWidth () const override |
| Image (GLuint textureHandle, int width, int height, bool autoFree) | |
| Image (std::span< unsigned int const > pixels, int width, int height, bool convertToDisplayFormat=true) | |
| 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 |
| int | mHeight |
| std::vector< unsigned int > | mPixels |
| GLuint | mTextureHandle |
| int | mTextureHeight |
| int | mTextureWidth |
| int | mWidth |
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 | resetImageLoader () |
| static void | setImageLoader (ImageLoader *imageLoader) |
| Static Protected Attributes inherited from fcn::Image | |
| static ImageLoader * | mImageLoader = nullptr |
OpenGL-specific implementation of Image.
Definition at line 37 of file backends/opengl/image.hpp.
| fcn::opengl::Image::Image | ( | std::span< unsigned int const > | pixels, |
| int | width, | ||
| int | height, | ||
| bool | convertToDisplayFormat = true ) |
Constructor.
Loads an image from an array of pixels. The pixel array is is copied in the constructor and should thus be freed after the constructor has been called.
| pixels | pixel buffer to load from. |
| width | the width of the image. |
| height | the height of the image. |
| convertToDisplayFormat | true if the image should be converted to display, false otherwise. |
Definition at line 16 of file backends/opengl/image.cpp.
References convertToDisplayFormat(), mAutoFree, mHeight, mPixels, mTextureHandle, mTextureHeight, mTextureWidth, and mWidth.
| fcn::opengl::Image::Image | ( | GLuint | textureHandle, |
| int | width, | ||
| int | height, | ||
| bool | autoFree ) |
Constructor.
Load an image from an OpenGL texture handle. The width and height specifies the size of the "interesting" part of the texture, the real width and height of the texture are assumed to be the closest higher power of two.
| textureHandle | the texture handle from which to load. |
| width | the width of the image. |
| height | the height of the image. |
| autoFree | true if the surface should automatically be deleted. |
Definition at line 57 of file backends/opengl/image.cpp.
References mAutoFree, mHeight, mPixels, mTextureHandle, mTextureHeight, mTextureWidth, and mWidth.
|
overridevirtual |
Reimplemented from fcn::Image.
Definition at line 76 of file backends/opengl/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 167 of file backends/opengl/image.cpp.
References mPixels, mTextureHandle, mTextureHeight, mTextureWidth, and fcn::throwException().
Referenced by Image().
|
overridevirtual |
Frees an image.
Implements fcn::Image.
Definition at line 102 of file backends/opengl/image.cpp.
References mPixels, and mTextureHandle.
|
overridevirtual |
Gets the height of the image.
Implements fcn::Image.
Definition at line 116 of file backends/opengl/image.cpp.
References mHeight.
|
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 121 of file backends/opengl/image.cpp.
References mHeight, mPixels, mTextureWidth, mWidth, and fcn::throwException().
|
virtual |
Gets the OpenGL texture handle for the image.
Definition at line 87 of file backends/opengl/image.cpp.
References mTextureHandle.
|
virtual |
Gets the height of the texture.
Definition at line 97 of file backends/opengl/image.cpp.
References mTextureHeight.
|
virtual |
Gets the width of texture.
Definition at line 92 of file backends/opengl/image.cpp.
References mTextureWidth.
|
overridevirtual |
Gets the width of the image.
Implements fcn::Image.
Definition at line 111 of file backends/opengl/image.cpp.
References mWidth.
|
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 148 of file backends/opengl/image.cpp.
References fcn::Color::a, fcn::Color::b, fcn::Color::g, mHeight, mPixels, mTextureWidth, mWidth, fcn::Color::r, and fcn::throwException().
|
protected |
Whether the texture handle should be freed on destruction.
Definition at line 116 of file backends/opengl/image.hpp.
|
protected |
Logical image height in pixels.
Definition at line 122 of file backends/opengl/image.hpp.
Referenced by getHeight(), getPixel(), Image(), Image(), and putPixel().
|
protected |
Pixel buffer copy for the image (RGBA packed).
Definition at line 113 of file backends/opengl/image.hpp.
Referenced by convertToDisplayFormat(), free(), getPixel(), Image(), Image(), and putPixel().
|
protected |
OpenGL texture handle backing this image (if any).
Definition at line 110 of file backends/opengl/image.hpp.
Referenced by convertToDisplayFormat(), free(), getTextureHandle(), Image(), and Image().
|
protected |
Actual texture height (power-of-two) used by GL.
Definition at line 128 of file backends/opengl/image.hpp.
Referenced by convertToDisplayFormat(), getTextureHeight(), Image(), and Image().
|
protected |
Actual texture width (power-of-two) used by GL.
Definition at line 125 of file backends/opengl/image.hpp.
Referenced by convertToDisplayFormat(), getPixel(), getTextureWidth(), Image(), Image(), and putPixel().
|
protected |
Logical image width in pixels.
Definition at line 119 of file backends/opengl/image.hpp.
Referenced by getPixel(), getWidth(), Image(), Image(), and putPixel().