cesium-native 0.62.0
Loading...
Searching...
No Matches
ImageManipulation.h
1#pragma once
2
3#include <CesiumImage/Library.h>
4
5#include <cstddef>
6#include <cstdint>
7#include <vector>
8
9namespace CesiumImage {
10
11struct ImageAsset;
12
20 int32_t x;
21
25 int32_t y;
26
30 int32_t width;
31
35 int32_t height;
36};
37
41class CESIUMIMAGE_API ImageManipulation {
42public:
58 static void unsafeBlitImage(
59 std::byte* pTarget,
60 size_t targetRowStride,
61 const std::byte* pSource,
62 size_t sourceRowStride,
63 size_t sourceWidth,
64 size_t sourceHeight,
65 size_t bytesPerPixel);
66
94 static bool blitImage(
95 ImageAsset& target,
96 const PixelRectangle& targetPixels,
97 const ImageAsset& source,
98 const PixelRectangle& sourcePixels);
99
107 static std::vector<std::byte> savePng(const ImageAsset& image);
108
117 static void savePng(const ImageAsset& image, std::vector<std::byte>& output);
118};
119
120} // namespace CesiumImage
A collection of utility functions for image manipulation operations.
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 ImageAsset &image, std::vector< std::byte > &output)
Saves an image to an existing byte buffer in PNG format.
static std::vector< std::byte > savePng(const ImageAsset &image)
Saves an image to a new byte buffer in PNG format.
static bool blitImage(ImageAsset &target, const PixelRectangle &targetPixels, const ImageAsset &source, const PixelRectangle &sourcePixels)
Copies pixels from a source image to a target image.
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
Specifies a rectangle of pixels in an image.
int32_t x
The X coordinate of the top-left corner of the rectangle.
int32_t height
The total number of pixels in the vertical direction.
int32_t width
The total number of pixels in the horizontal direction.
int32_t y
The Y coordinate of the top-left corner of the rectangle.