cesium-native  0.41.0
CesiumGltfReader::ImageDecoder Class Reference

Contains methods for reading and manipulating images. More...

#include <CesiumGltfReader/ImageDecoder.h>

Static Public Member Functions

static ImageReaderResult readImage (const gsl::span< const std::byte > &data, const CesiumGltf::Ktx2TranscodeTargets &ktx2TranscodeTargets)
 Reads an image from a buffer. More...
 
static std::optional< std::string > generateMipMaps (CesiumGltf::ImageAsset &image)
 Generate mipmaps for this image. More...
 

Detailed Description

Contains methods for reading and manipulating images.

Definition at line 42 of file ImageDecoder.h.

Member Function Documentation

◆ generateMipMaps()

static std::optional<std::string> CesiumGltfReader::ImageDecoder::generateMipMaps ( CesiumGltf::ImageAsset image)
static

Generate mipmaps for this image.

Does nothing if mipmaps already exist or the compressedPixelFormat is not GpuCompressedPixelFormat::NONE.

Parameters
imageThe image to generate mipmaps for. *
Returns
A string describing the error, if unable to generate mipmaps.

◆ readImage()

static ImageReaderResult CesiumGltfReader::ImageDecoder::readImage ( const gsl::span< const std::byte > &  data,
const CesiumGltf::Ktx2TranscodeTargets ktx2TranscodeTargets 
)
static

Reads an image from a buffer.

The stb_image library is used to decode images in JPG, PNG, TGA, BMP, PSD, GIF, HDR, or PIC format.

Parameters
dataThe buffer from which to read the image.
ktx2TranscodeTargetFormatThe compression format to transcode KTX v2 textures into. If this is std::nullopt, KTX v2 textures will be fully decompressed into raw pixels.
Returns
The result of reading the image.

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