cesium-native 0.43.0
Loading...
Searching...
No Matches
ImageManipulation.h
1#pragma once
2
3#include "Library.h"
4
5#include <cstddef>
6#include <cstdint>
7
8// Forward declarations
9namespace CesiumGltf {
10struct ImageAsset;
11}
12
13namespace CesiumGltfContent {
14
22 int32_t x;
23
27 int32_t y;
28
32 int32_t width;
33
37 int32_t height;
38};
39
43class CESIUMGLTFCONTENT_API ImageManipulation {
44public:
60 static void unsafeBlitImage(
61 std::byte* pTarget,
62 size_t targetRowStride,
63 const std::byte* pSource,
64 size_t sourceRowStride,
65 size_t sourceWidth,
66 size_t sourceHeight,
67 size_t bytesPerPixel);
68
96 static bool blitImage(
98 const PixelRectangle& targetPixels,
99 const CesiumGltf::ImageAsset& source,
100 const PixelRectangle& sourcePixels);
101
109 static std::vector<std::byte> savePng(const CesiumGltf::ImageAsset& image);
110
119 static void
120 savePng(const CesiumGltf::ImageAsset& image, std::vector<std::byte>& output);
121};
122
123} // namespace CesiumGltfContent
A collection of utility functions for image manipulation operations.
static std::vector< std::byte > savePng(const CesiumGltf::ImageAsset &image)
Saves an image to a new byte buffer in PNG format.
static bool blitImage(CesiumGltf::ImageAsset &target, const PixelRectangle &targetPixels, const CesiumGltf::ImageAsset &source, const PixelRectangle &sourcePixels)
Copies pixels from a source image to a target image.
static void unsafeBlitImage(std::byte *pTarget, size_t targetRowStride, const std::byte *pSource, size_t sourceRowStride, size_t sourceWidth, size_t sourceHeight, size_t bytesPerPixel)
Directly copies pixels from a source to a target, without validating the provided pointers or ranges.
static void savePng(const CesiumGltf::ImageAsset &image, std::vector< std::byte > &output)
Saves an image to an existing byte buffer in PNG format.
Classes that support manipulating the content of a glTF.
Classes for working with glTF models.
Specifies a rectangle of pixels in an image.
int32_t width
The total number of pixels in the horizontal direction.
int32_t height
The total number of pixels in the vertical direction.
int32_t x
The X coordinate of the top-left corner of the rectangle.
int32_t y
The Y coordinate of the top-left corner of the rectangle.
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