cesium-native 0.44.2
Loading...
Searching...
No Matches
ImageManipulation.h
1#pragma once
2
3#include <CesiumGltfContent/Library.h>
4
5#include <cstddef>
6#include <cstdint>
7#include <vector>
8
9// Forward declarations
10namespace CesiumGltf {
11struct ImageAsset;
12}
13
14namespace CesiumGltfContent {
15
23 int32_t x;
24
28 int32_t y;
29
33 int32_t width;
34
38 int32_t height;
39};
40
44class CESIUMGLTFCONTENT_API ImageManipulation {
45public:
61 static void unsafeBlitImage(
62 std::byte* pTarget,
63 size_t targetRowStride,
64 const std::byte* pSource,
65 size_t sourceRowStride,
66 size_t sourceWidth,
67 size_t sourceHeight,
68 size_t bytesPerPixel);
69
97 static bool blitImage(
99 const PixelRectangle& targetPixels,
100 const CesiumGltf::ImageAsset& source,
101 const PixelRectangle& sourcePixels);
102
110 static std::vector<std::byte> savePng(const CesiumGltf::ImageAsset& image);
111
120 static void
121 savePng(const CesiumGltf::ImageAsset& image, std::vector<std::byte>& output);
122};
123
124} // 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