cesium-native 0.44.2
Loading...
Searching...
No Matches
ImageDecoder.h
1#pragma once
2
3#include <CesiumGltf/ImageAsset.h>
4#include <CesiumGltfReader/Library.h>
5#include <CesiumUtility/IntrusivePointer.h>
6
7#include <optional>
8#include <span>
9#include <string>
10#include <vector>
11
12namespace CesiumGltfReader {
13
17struct CESIUMGLTFREADER_API ImageReaderResult {
18
25
29 std::vector<std::string> errors;
30
34 std::vector<std::string> warnings;
35};
36
41public:
55 const std::span<const std::byte>& data,
56 const CesiumGltf::Ktx2TranscodeTargets& ktx2TranscodeTargets);
57
67 static std::optional<std::string>
69
86 static bool unsafeResize(
87 const std::byte* pInputPixels,
88 int32_t inputWidth,
89 int32_t inputHeight,
90 int32_t inputStrideBytes,
91 std::byte* pOutputPixels,
92 int32_t outputWidth,
93 int32_t outputHeight,
94 int32_t outputStrideBytes,
95 int32_t channels);
96};
97
98} // namespace CesiumGltfReader
Contains methods for reading and manipulating images.
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.
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.
A smart pointer that calls addReference and releaseReference on the controlled object.
Classes for reading glTF models.
Definition GltfReader.h:23
The result of reading an image with ImageDecoder::readImage.
std::vector< std::string > errors
Error messages that occurred while trying to read the image.
CesiumUtility::IntrusivePointer< CesiumGltf::ImageAsset > pImage
The CesiumGltf::ImageAsset that was read.
std::vector< std::string > warnings
Warning messages that occurred while reading the image.
A 2D image asset, including its pixel data. The image may have mipmaps, and it may be encoded in a GP...
Definition ImageAsset.h:34
For each possible input transmission format, this struct names the ideal target gpu-compressed pixel ...