TGUI  0.9.5
Loading...
Searching...
No Matches
tgui::ImageLoader Struct Reference

Class that is internally used to load an image from a file or from memory. More...

#include <TGUI/Loading/ImageLoader.hpp>

Static Public Member Functions

static std::unique_ptr< std::uint8_t[]> loadFromFile (const String &filename, Vector2u &imageSize)
 Loads an image from a file.
 
static std::unique_ptr< std::uint8_t[]> loadFromMemory (const std::uint8_t *data, std::size_t dataSize, Vector2u &imageSize)
 Loads an image from memory (data in memory should contain the entire file, not just the pixels)
 

Detailed Description

Class that is internally used to load an image from a file or from memory.

Member Function Documentation

◆ loadFromFile()

static std::unique_ptr< std::uint8_t[]> tgui::ImageLoader::loadFromFile ( const String filename,
Vector2u imageSize 
)
static

Loads an image from a file.

Parameters
filenameThe file to load
imageSizeOutput parameter that will contain the width and height of the image if loaded successfully
Returns
RGBA array of pixels of loaded image (4 * imageSize.x * imageSize.y bytes), or nullptr if loading failed

◆ loadFromMemory()

static std::unique_ptr< std::uint8_t[]> tgui::ImageLoader::loadFromMemory ( const std::uint8_t *  data,
std::size_t  dataSize,
Vector2u imageSize 
)
static

Loads an image from memory (data in memory should contain the entire file, not just the pixels)

Parameters
dataPointer to the file in memory
dataSizeAmount of bytes of the file in memory
imageSizeOutput parameter that will contain the width and height of the image if loaded successfully
Returns
RGBA array of pixels of loaded image (4 * imageSize.x * imageSize.y bytes), or nullptr if loading failed

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