TGUI  0.10-dev
tgui::BackendTexture Class Reference

Base class for texture implementations that depend on the backend. More...

#include <TGUI/Backend/Renderer/BackendTexture.hpp>

Inheritance diagram for tgui::BackendTexture:
tgui::BackendTextureGLES2 tgui::BackendTextureOpenGL3 tgui::BackendTextureSDL tgui::BackendTextureSFML

Public Member Functions

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. More...
 
virtual bool loadTextureOnly (Vector2u size, const std::uint8_t *pixels, bool smooth)
 Loads the texture from an array of 32-bits RGBA pixels, but don't take ownership of the pixels. More...
 
Vector2u getSize () const
 Returns the size of the entire image. More...
 
virtual void setSmooth (bool smooth)
 Changes whether the smooth filter is enabled or not. More...
 
bool isSmooth () const
 Returns whether the smooth filter is enabled or not. More...
 
bool isTransparentPixel (Vector2u pixel) const
 Checks if a certain pixel is transparent. More...
 

Detailed Description

Base class for texture implementations that depend on the backend.

Member Function Documentation

◆ getSize()

Vector2u tgui::BackendTexture::getSize ( ) const

Returns the size of the entire image.

Returns
Texture size

◆ isSmooth()

bool tgui::BackendTexture::isSmooth ( ) const

Returns whether the smooth filter is enabled or not.

Returns
True if smoothing is enabled, false if it is disabled

◆ isTransparentPixel()

bool tgui::BackendTexture::isTransparentPixel ( Vector2u  pixel) const

Checks if a certain pixel is transparent.

Parameters
pixelCoordinate of the pixel
Returns
True when the pixel is transparent, false when it is not

◆ load()

bool tgui::BackendTexture::load ( Vector2u  size,
std::unique_ptr< std::uint8_t[]>  pixels,
bool  smooth 
)

Loads the texture from an array of 32-bits RGBA pixels.

Parameters
sizeWidth and height of the image to create
pixelsMoved pointer to array of size.x*size.y*4 bytes with RGBA pixels, or nullptr to create an empty texture
smoothShould the smooth filter be enabled or not?

◆ loadTextureOnly()

virtual bool tgui::BackendTexture::loadTextureOnly ( Vector2u  size,
const std::uint8_t *  pixels,
bool  smooth 
)
virtual

Loads the texture from an array of 32-bits RGBA pixels, but don't take ownership of the pixels.

Parameters
sizeWidth and height of the image to create
pixelsPointer to array of size.x*size.y*4 bytes with RGBA pixels, or nullptr to create an empty texture
smoothShould 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 in tgui::BackendTextureGLES2, tgui::BackendTextureOpenGL3, tgui::BackendTextureSDL, and tgui::BackendTextureSFML.

◆ setSmooth()

virtual void tgui::BackendTexture::setSmooth ( bool  smooth)
virtual

Changes whether the smooth filter is enabled or not.

Parameters
smoothTrue if smoothing should be enabled, false if it should be disabled

Reimplemented in tgui::BackendTextureGLES2, tgui::BackendTextureOpenGL3, tgui::BackendTextureSDL, and tgui::BackendTextureSFML.


The documentation for this class was generated from the following file: