19 SoftwareRenderingContext();
20 ~SoftwareRenderingContext()
override;
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;
100 std::uint8_t* mBitmapBlob =
nullptr;
102 std::unique_ptr<_XGC, void(*)(GC)> mGC = {
nullptr,
nullptr};
106#if AUI_PLATFORM_ANDROID || AUI_PLATFORM_APPLE || AUI_PLATFORM_EMSCRIPTEN
107 std::uint8_t* mBitmapBlob =
nullptr;
Definition CommonRenderingContext.h:28
#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