14#include <AUI/Platform/CommonRenderingContext.h>
15#include <AUI/Platform/AWindow.h>
22 void destroyNativeWindow(
AWindowBase& window)
override;
26 void init(
const Init& init)
override;
30 AImage makeScreenshot()
override;
32 inline uint8_t& stencil(
const glm::uvec2& position) {
33 return mStencilBlob.at<uint8_t>(mBitmapSize.x * position.y + position.x);
37 glm::uvec2 bitmapSize()
const {
41 inline void putPixel(
const glm::uvec2& position,
const glm::u8vec3& color)
noexcept {
42 putPixel(position, glm::u8vec4(color, 255));
45 inline void putPixel(
const glm::uvec2& position,
const glm::u8vec4& color)
noexcept {
46 AUI_ASSERTX(glm::all(glm::lessThan(position, mBitmapSize)),
"image out of bounds");
48 auto dataPtr =
reinterpret_cast<uint8_t*
>(mBitmapBlob.data() +
sizeof(BITMAPINFO)
49 + (mBitmapSize.x * position.y + position.x) * 4);
50 dataPtr[0] = color[2];
51 dataPtr[1] = color[1];
52 dataPtr[2] = color[0];
53 dataPtr[3] = color[3];
55 inline glm::u8vec4 getPixel(
const glm::uvec2& position)
noexcept {
56 AUI_ASSERTX(glm::all(glm::lessThan(position, mBitmapSize)),
"image out of bounds");
58 auto dataPtr =
reinterpret_cast<uint8_t*
>(mBitmapBlob.data() +
sizeof(BITMAPINFO)
59 + (mBitmapSize.x * position.y + position.x) * 4);
61 return { dataPtr[2], dataPtr[1], dataPtr[0], dataPtr[3] };
64 inline void putPixel(
const glm::uvec2& position,
const glm::u8vec4& color)
noexcept {
65 AUI_ASSERTX(glm::all(glm::lessThan(position, mBitmapSize)),
"image out of bounds");
67 auto dataPtr =
reinterpret_cast<uint8_t*
>(mBitmapBlob + (mBitmapSize.x * position.y + position.x) * 4);
68 dataPtr[0] = color[2];
69 dataPtr[1] = color[1];
70 dataPtr[2] = color[0];
71 dataPtr[3] = color[3];
73 inline glm::u8vec4 getPixel(
const glm::uvec2& position)
noexcept {
74 AUI_ASSERTX(glm::all(glm::lessThan(position, mBitmapSize)),
"image out of bounds");
76 auto dataPtr =
reinterpret_cast<uint8_t*
>(mBitmapBlob + (mBitmapSize.x * position.y + position.x) * 4);
90 glm::uvec2 mBitmapSize;
92 void reallocateImageBuffers(
const AWindowBase& window);
97 BITMAPINFO* mBitmapInfo;
98#elif AUI_PLATFORM_LINUX
99 std::uint8_t* mBitmapBlob =
nullptr;
101 std::unique_ptr<_XGC, void(*)(GC)> mGC = {
nullptr,
nullptr};
105 std::uint8_t* mBitmapBlob =
nullptr;
std::vector-like growing array for byte storage.
Definition: AByteBuffer.h:31
Definition: AWindowBase.h:33
Definition: CommonRenderingContext.h:28
Base class for rendering.
Definition: IRenderer.h:149
Definition: SoftwareRenderingContext.h:17
An std::weak_ptr with AUI extensions.
Definition: SharedPtrTypes.h:177
#define AUI_ASSERTX(condition, what)
Asserts that the passed condition evaluates to true. Adds extra message string.
Definition: Assert.h:74
Definition: IRenderingContext.h:38
Forbids copy of your class.
Definition: values.h:40