cesium-native 0.62.0
Loading...
Searching...
No Matches
ImageDecoder.h
1#pragma once
2
3#include <CesiumImage/ImageAsset.h>
4#include <CesiumImage/Library.h>
5#include <CesiumUtility/IntrusivePointer.h>
6
7#include <optional>
8#include <span>
9#include <string>
10#include <vector>
11
12namespace CesiumImage {
13
15
19struct CESIUMIMAGE_API ImageReaderResult {
20
27
31 std::vector<std::string> errors;
32
36 std::vector<std::string> warnings;
37};
38
43public:
57 const std::span<const std::byte>& data,
58 const Ktx2TranscodeTargets& ktx2TranscodeTargets);
59
69 static std::optional<std::string> generateMipMaps(ImageAsset& image);
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 CesiumImage
Contains methods for reading and manipulating images.
static ImageReaderResult readImage(const std::span< const std::byte > &data, const Ktx2TranscodeTargets &ktx2TranscodeTargets)
Reads an image from a buffer.
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 std::optional< std::string > generateMipMaps(ImageAsset &image)
Generate mipmaps for this image.
A smart pointer that calls addReference and releaseReference on the controlled object.
Classes that support reading, decoding, and manipulating images.
Definition ImageAsset.h:11
A 2D image asset, including its pixel data. The image may have mipmaps, and it may be encoded in a GP...
Definition ImageAsset.h:33
The result of reading an image with ImageDecoder::readImage.
std::vector< std::string > errors
Error messages that occurred while trying to read the image.
std::vector< std::string > warnings
Warning messages that occurred while reading the image.
CesiumUtility::IntrusivePointer< ImageAsset > pImage
The ImageAsset that was read.
For each possible input transmission format, this struct names the ideal target gpu-compressed pixel ...