cesium-native 0.43.0
Loading...
Searching...
No Matches
ImageDecoder.h
1#pragma once
2
3#include "CesiumGltf/ImageAsset.h"
4#include "CesiumGltfReader/Library.h"
5
6#include <CesiumUtility/IntrusivePointer.h>
7
8#include <optional>
9#include <span>
10#include <string>
11#include <vector>
12
13namespace CesiumGltfReader {
14
18struct CESIUMGLTFREADER_API ImageReaderResult {
19
26
30 std::vector<std::string> errors;
31
35 std::vector<std::string> warnings;
36};
37
42public:
56 const std::span<const std::byte>& data,
57 const CesiumGltf::Ktx2TranscodeTargets& ktx2TranscodeTargets);
58
68 static std::optional<std::string>
70
87 static bool unsafeResize(
88 const std::byte* pInputPixels,
89 int32_t inputWidth,
90 int32_t inputHeight,
91 int32_t inputStrideBytes,
92 std::byte* pOutputPixels,
93 int32_t outputWidth,
94 int32_t outputHeight,
95 int32_t outputStrideBytes,
96 int32_t channels);
97};
98
99} // 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:24
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 ...