|
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 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 (Image &&)=delete | |
| Image (Image const &)=delete | |
| Image (std::span< unsigned int const > pixels, int width, int height, bool convertToDisplayFormat=true) | |
| 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 |
| 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 | setImageLoader (ImageLoader *imageLoader) |
| Static Protected Attributes inherited from fcn::Image | |
| static ImageLoader * | mImageLoader = nullptr |
OpenGL-specific implementation of Image.
Definition at line 33 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.
NOTE: The functions getPixel and putPixel are only guaranteed to work before an image has been converted to display format.
| 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 13 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 54 of file backends/opengl/image.cpp.
References mAutoFree, mHeight, mPixels, mTextureHandle, mTextureHeight, mTextureWidth, and mWidth.
|
overridevirtual |
Reimplemented from fcn::Image.
Definition at line 73 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 164 of file backends/opengl/image.cpp.
References mPixels, mTextureHandle, mTextureHeight, and mTextureWidth.
Referenced by Image().
|
overridevirtual |
Frees an image.
Implements fcn::Image.
Definition at line 99 of file backends/opengl/image.cpp.
References mPixels, and mTextureHandle.
|
overridevirtual |
Gets the height of the image.
Implements fcn::Image.
Definition at line 113 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 118 of file backends/opengl/image.cpp.
References mHeight, mPixels, mTextureWidth, and mWidth.
|
virtual |
Gets the OpenGL texture handle for the image.
Definition at line 84 of file backends/opengl/image.cpp.
References mTextureHandle.
|
virtual |
Gets the height of the texture.
Definition at line 94 of file backends/opengl/image.cpp.
References mTextureHeight.
|
virtual |
Gets the width of texture.
Definition at line 89 of file backends/opengl/image.cpp.
References mTextureWidth.
|
overridevirtual |
Gets the width of the image.
Implements fcn::Image.
Definition at line 108 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 145 of file backends/opengl/image.cpp.
References fcn::Color::a, fcn::Color::b, fcn::Color::g, mHeight, mPixels, mTextureWidth, mWidth, and fcn::Color::r.
|
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().