20#include "TinyGPU/Vector.h"
25
26
27
28
29
30
31
32
33
34
35
36
38template <
typename RGB_T =
RGB565>
40 static_assert(!std::is_same<RGB_T,
bool>::value,
41 "Use SurfaceMonochrome for monochrome surfaces");
62 void setPixel(size_t x, size_t y, RGB_T color)
override {
63 if (buffer.empty())
return;
64 buffer[(y * width_) + x] = color;
71 RGB_T
getPixel(size_t x, size_t y)
const override {
72 if (buffer.empty())
return RGB_T();
73 return buffer[(y * width_) + x];
82 return buffer.size() == (w * h) || (w * h == 0 && buffer.empty());
87 const uint8_t*
data()
const override {
88 return reinterpret_cast<
const uint8_t*>(buffer.data());
93 size_t size()
const override {
return buffer.size() * RGB_T::size() / 8; }
100template <
typename RGB_T =
RGB565>
Font rendering interface for TinyGPU-compatible framebuffers.
Definition: IFont.h:19
RGB color stored in 16-bit RGB565 format.
Definition: RGB565.h:13
Base class for 2D surfaces with drawing and text rendering support.
Definition: SurfaceBase.h:25
In-memory bitmap surface with basic 2D drawing and text rendering.
Definition: Surface.h:39
Surface()=default
Default constructor. Creates an empty surface.
Surface(size_t w, size_t h, IFont< RGB_T > &font)
Constructs a surface with the given width, height, and font.
Definition: Surface.h:55
const uint8_t * data() const override
Returns a pointer to the raw data as bytes.
Definition: Surface.h:87
void setPixel(size_t x, size_t y, RGB_T color) override
Sets the pixel at (x, y) to the specified color.
Definition: Surface.h:62
size_t size() const override
Returns the size of the buffer in bytes.
Definition: Surface.h:93
bool resizeBuffer(size_t w, size_t h) override
Resizes the internal pixel buffer to the specified width and height.
Definition: Surface.h:80
RGB_T getPixel(size_t x, size_t y) const override
Gets the color of the pixel at (x, y).
Definition: Surface.h:71
Vector< RGB_T > buffer
Definition: Surface.h:96
Definition: AVIWriter.h:9