Contains methods for reading and manipulating images.
More...
#include <CesiumGltfReader/ImageDecoder.h>
|
static ImageReaderResult | readImage (const std::span< const std::byte > &data, const CesiumGltf::Ktx2TranscodeTargets &ktx2TranscodeTargets) |
| Reads an image from a buffer.
|
|
static std::optional< std::string > | generateMipMaps (CesiumGltf::ImageAsset &image) |
| Generate mipmaps for this image.
|
|
static bool | unsafeResize (const std::byte *pInputPixels, int32_t inputWidth, int32_t inputHeight, int32_t inputStrideBytes, std::byte *pOutputPixels, int32_t outputWidth, int32_t outputHeight, int32_t outputStrideBytes, int32_t channels) |
| Resize an image, without validating the provided pointers or ranges.
|
|
Contains methods for reading and manipulating images.
Definition at line 41 of file ImageDecoder.h.
◆ 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
-
image | The image to generate mipmaps for. * |
- Returns
- A string describing the error, if unable to generate mipmaps.
◆ readImage()
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
-
data | The buffer from which to read the image. |
ktx2TranscodeTargets | The 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.
◆ unsafeResize()
static bool CesiumGltfReader::ImageDecoder::unsafeResize |
( |
const std::byte * | pInputPixels, |
|
|
int32_t | inputWidth, |
|
|
int32_t | inputHeight, |
|
|
int32_t | inputStrideBytes, |
|
|
std::byte * | pOutputPixels, |
|
|
int32_t | outputWidth, |
|
|
int32_t | outputHeight, |
|
|
int32_t | outputStrideBytes, |
|
|
int32_t | channels ) |
|
static |
Resize an image, without validating the provided pointers or ranges.
- Parameters
-
pInputPixels | The input image. |
inputWidth | The width of the input image, in pixels. |
inputHeight | The height of the input image, in pixels. |
inputStrideBytes | The stride of the input image, in bytes. Stride is the number of bytes between successive rows. |
pOutputPixels | The buffer into which to write the output image. |
outputWidth | The width of the output image, in pixels. |
outputHeight | The height of the otuput image, in pixels. |
outputStrideBytes | The stride of the output image, in bytes. Stride is the number of bytes between successive rows. |
channels | The number of channels in both the input and output images. |
- Returns
- True if the resize succeeded, false if it failed.
The documentation for this class was generated from the following file:
- /home/runner/work/cesium-native/cesium-native/CesiumGltfReader/include/CesiumGltfReader/ImageDecoder.h