Texture implementation that makes use of raylib.
More...
#include <TGUI/Backend/Renderer/Raylib/BackendTextureRaylib.hpp>
|
| ~BackendTextureRaylib () override |
| Destructor.
|
|
bool | loadTextureOnly (Vector2u size, const std::uint8_t *pixels, bool smooth) override |
| Loads the texture from an array of 32-bits RGBA pixels, but don't take ownership of the pixels.
|
|
void | setSmooth (bool smooth) override |
| Changes whether the smooth filter is enabled or not.
|
|
const Texture2D & | getInternalTexture () const |
| Returns a pointer to the internal Texture2D.
|
|
void | replaceInternalTexture (const Texture2D &texture) |
| Replaces the internal texture by a different one.
|
|
| BackendTexture (const BackendTexture &)=delete |
|
| BackendTexture (BackendTexture &&)=delete |
|
BackendTexture & | operator= (const BackendTexture &)=delete |
|
BackendTexture & | operator= (BackendTexture &&)=delete |
|
| BackendTexture ()=default |
| Default constructor.
|
|
virtual | ~BackendTexture ()=default |
| Virtual destructor.
|
|
bool | load (Vector2u size, std::unique_ptr< std::uint8_t[]> pixels, bool smooth) |
| Loads the texture from an array of 32-bits RGBA pixels.
|
|
Vector2u | getSize () const |
| Returns the size of the entire image.
|
|
bool | isSmooth () const |
| Returns whether the smooth filter is enabled or not.
|
|
bool | isTransparentPixel (Vector2u pixel) const |
| Checks if a certain pixel is transparent.
|
|
const std::uint8_t * | getPixels () const |
| Returns a pointer to the pixels (read-only)
|
|
|
Texture2D | m_texture |
|
Vector2u | m_imageSize |
|
std::unique_ptr< std::uint8_t[]> | m_pixels |
|
bool | m_isSmooth = true |
|
Texture implementation that makes use of raylib.
- Since
- TGUI 1.3
◆ getInternalTexture()
const Texture2D & tgui::BackendTextureRaylib::getInternalTexture |
( |
| ) |
const |
|
nodiscard |
Returns a pointer to the internal Texture2D.
- Returns
- Pointer to internal texture, or nullptr when the texture was not initialized yet
◆ loadTextureOnly()
bool tgui::BackendTextureRaylib::loadTextureOnly |
( |
Vector2u | size, |
|
|
const std::uint8_t * | pixels, |
|
|
bool | smooth ) |
|
overridevirtual |
Loads the texture from an array of 32-bits RGBA pixels, but don't take ownership of the pixels.
- Parameters
-
size | Width and height of the image to create |
pixels | Pointer to array of size.x*size.y*4 bytes with RGBA pixels, or nullptr to create an empty texture |
smooth | Should the smooth filter be enabled or not? |
- Warning
- Unlike the load function, loadTextureOnly won't store the pixels and isTransparentPixel thus won't work
Reimplemented from tgui::BackendTexture.
◆ replaceInternalTexture()
void tgui::BackendTextureRaylib::replaceInternalTexture |
( |
const Texture2D & | texture | ) |
|
Replaces the internal texture by a different one.
- Parameters
-
This will remove the pixel data stored by this object and reset its smoothing and size based on the new texture.
- Warning
- Ownership of the texture is transferred by calling this function. The UnloadTexture function will be called when this object is destroyed and it should NOT be called by the caller of replaceInternalTexture.
◆ setSmooth()
void tgui::BackendTextureRaylib::setSmooth |
( |
bool | smooth | ) |
|
|
overridevirtual |
Changes whether the smooth filter is enabled or not.
- Parameters
-
smooth | True if smoothing should be enabled, false if it should be disabled |
Reimplemented from tgui::BackendTexture.
The documentation for this class was generated from the following file: