8#include "TinyGPU/Vector.h"
13
14
15
16
17
18
19
40 void setPixel(size_t x, size_t y,
bool color)
override {
41 if (buffer.empty())
return;
42 size_t idx = y * width_ + x;
43 size_t byte = idx / 8;
46 buffer[byte] |= (1 << bit);
48 buffer[byte] &= ~(1 << bit);
55 bool getPixel(size_t x, size_t y)
const override {
56 if (buffer.empty())
return false;
58 size_t idx = y * width_ + x;
59 size_t byte = idx / 8;
61 return (buffer[byte] >> bit) & 1;
68 size_t bytes = (w * h + 7) / 8;
70 return buffer.size() == bytes || (bytes == 0 && buffer.empty());
Font rendering interface for TinyGPU-compatible framebuffers.
Definition: IFont.h:19
In-memory 1-bit (monochrome) bitmap surface with 2D drawing and text rendering.
Definition: SurfaceMonochrome.h:20
bool getPixel(size_t x, size_t y) const override
Gets the value of the pixel at (x, y).
Definition: SurfaceMonochrome.h:55
SurfaceMonochrome(size_t w, size_t h, IFont< bool > &font)
Constructs a monochrome surface with the given width, height, and font.
Definition: SurfaceMonochrome.h:33
SurfaceMonochrome()=default
Default constructor. Creates an empty monochrome surface.
const uint8_t * data() const override
Returns a pointer to the raw bit-packed data as bytes.
Definition: SurfaceMonochrome.h:75
size_t size() const override
Returns the size of the buffer in bytes.
Definition: SurfaceMonochrome.h:79
bool resizeBuffer(size_t w, size_t h) override
Resizes the internal bit-packed buffer to the specified width and height.
Definition: SurfaceMonochrome.h:67
Vector< uint8_t > buffer
Definition: SurfaceMonochrome.h:82
void setPixel(size_t x, size_t y, bool color) override
Sets the pixel at (x, y) to the specified color (on/off).
Definition: SurfaceMonochrome.h:40
Definition: AVIWriter.h:9