|
TinyGPU
|
Abstract framebuffer and drawing interface for TinyGPU surfaces. More...
#include <ISurface.h>

Public Member Functions | |
| virtual | ~ISurface ()=default |
| Destroys the framebuffer interface. | |
| virtual bool | begin ()=0 |
| Initializes the framebuffer surface. | |
| virtual void | end ()=0 |
| Closes the framebuffer and releases resources. | |
| virtual bool | resize (size_t newWidth, size_t newHeight)=0 |
| Resizes the framebuffer surface. | |
| virtual void | setPixel (size_t x, size_t y, RGB_T color)=0 |
| Sets a pixel at the given position. | |
| virtual RGB_T | getPixel (size_t x, size_t y) const =0 |
| Returns the pixel at the given position. | |
| virtual void | scroll (int dx, int dy)=0 |
| Scrolls the framebuffer content by the specified offsets. | |
| virtual void | clear (RGB_T color=RGB_T(0))=0 |
| Clears the framebuffer with a single color. | |
| virtual void | drawLine (size_t x0, size_t y0, size_t x1, size_t y1, RGB_T color)=0 |
| Draws a line between two points. | |
| virtual void | drawRect (size_t x, size_t y, size_t w, size_t h, RGB_T color)=0 |
| Draws a rectangle outline. | |
| virtual void | fillRect (size_t x, size_t y, size_t w, size_t h, RGB_T color)=0 |
| Fills a rectangle. | |
| virtual void | drawCircle (size_t x, size_t y, size_t r, RGB_T color)=0 |
| Draws a circle outline. | |
| virtual void | fillCircle (size_t x, size_t y, size_t r, RGB_T color)=0 |
| Fills a circle. | |
| virtual void | drawRoundRect (size_t x, size_t y, size_t w, size_t h, size_t radius, RGB_T color) |
| virtual void | fillRoundRect (size_t x, size_t y, size_t w, size_t h, size_t radius, RGB_T color) |
| virtual void | drawArc (size_t cx, size_t cy, size_t r, float startDeg, float endDeg, RGB_T color, uint8_t thickness=1) |
| virtual void | drawSprite (size_t x, size_t y, const ISurface< RGB_T > &sprite, RGB_T invisibleColor=RGB_T(0))=0 |
| Draws a sprite using an optional transparent color. | |
| virtual void | clearSprite (size_t x, size_t y, ISurface< RGB_T > &sprite, RGB_T clearColor=RGB_T(0))=0 |
| Clears the area covered by a sprite. | |
| virtual void | copySprite (size_t x, size_t y, const ISurface< RGB_T > &sprite)=0 |
| Copies pixels from the framebuffer into a sprite. | |
| virtual size_t | width () const =0 |
| Returns the framebuffer width in pixels. | |
| virtual size_t | height () const =0 |
| Returns the framebuffer height in pixels. | |
| virtual void | drawText (int16_t x, int16_t y, const char *text, RGB_T foreground, RGB_T background=RGB_T(0), bool opaque=false, uint8_t scale=1, uint8_t spacing=1, uint8_t lineSpacing=1)=0 |
| Draws UTF-8 text using the configured font. | |
| virtual IFont< RGB_T > & | font ()=0 |
| Returns the currently set font for text rendering. | |
| virtual const uint8_t * | data () const =0 |
| Provides access to the framebuffer as a byte buffer. | |
| virtual size_t | size () const =0 |
| Provides the total data size in bytes. | |
| virtual bool | contains (size_t x, size_t y)=0 |
| Checks if the given coordinates are within the surface bounds. | |
| virtual void | pushClipRect (size_t x, size_t y, size_t w, size_t h) |
| virtual void | popClipRect () |
| virtual bool | isClipVisible (size_t x, size_t y) const |
Abstract framebuffer and drawing interface for TinyGPU surfaces.
Implementations expose pixel access, primitive drawing, sprite operations, and text rendering through a common API.
|
virtualdefault |
Destroys the framebuffer interface.
|
pure virtual |
Initializes the framebuffer surface.
Implemented in SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and FrameBuffer< RGB_T, SurfaceT >.
|
pure virtual |
Clears the framebuffer with a single color.
Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.
|
pure virtual |
Clears the area covered by a sprite.
Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.
|
pure virtual |
Checks if the given coordinates are within the surface bounds.
Implemented in CartesianView< RGB_T >, FrameBuffer< RGB_T, SurfaceT >, SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and WindowedSurface< RGB_T >.
|
pure virtual |
Copies pixels from the framebuffer into a sprite.
Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.
|
pure virtual |
Provides access to the framebuffer as a byte buffer.
Implemented in CartesianView< RGB_T >, FrameBuffer< RGB_T, SurfaceT >, Surface< RGB_T >, Surface< RGB565 >, SurfaceMonochrome, SurfaceWithExternalBuffer< RGB_T >, and WindowedSurface< RGB_T >.
|
inlinevirtual |
Draws a stroked arc around center (cx, cy) with radius r, sweeping from startDeg to endDeg (degrees, clockwise on screen since y increases downward; 0 deg = +X/3 o'clock direction; pass endDeg < startDeg to wrap through 0, e.g. 350 -> 370). thickness draws that many concentric 1px radii ending at r. Used for circular progress/spinner widgets.
|
pure virtual |
Draws a circle outline.
Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.
|
pure virtual |
Draws a line between two points.
Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.
|
pure virtual |
Draws a rectangle outline.
Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.
|
inlinevirtual |
Draws a rectangle outline with rounded corners.
| radius | Corner radius in pixels; clamped to min(w,h)/2. |
Implemented here (not left pure virtual) purely in terms of drawLine(), setPixel() and contains(), so every existing ISurface implementation gets a correct default for free. Override only to provide a faster, hardware-specific version.
|
pure virtual |
Draws a sprite using an optional transparent color.
Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.
|
pure virtual |
Draws UTF-8 text using the configured font.
Implemented in SurfaceBase< PixelT >, and FrameBuffer< RGB_T, SurfaceT >.
|
pure virtual |
Closes the framebuffer and releases resources.
Implemented in SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and FrameBuffer< RGB_T, SurfaceT >.
|
pure virtual |
Fills a circle.
Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.
|
pure virtual |
Fills a rectangle.
Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.
|
inlinevirtual |
Fills a rectangle with rounded corners.
| radius | Corner radius in pixels; clamped to min(w,h)/2. |
Row-scan fill: each row's horizontal inset comes from the corner circle's equation (0 for the straight middle rows), then the existing fillRect() draws that single row. Produces the same shape as the classic "middle band + two rounded end caps" decomposition, just expressed as one loop. Implemented here (not pure virtual) so every existing ISurface implementation gets it for free.
|
pure virtual |
Returns the currently set font for text rendering.
Implemented in FrameBuffer< RGB_T, SurfaceT >, CartesianView< RGB_T >, SurfaceBase< PixelT >, SurfaceBase< RGB565 >, and SurfaceBase< bool >.
|
pure virtual |
Returns the pixel at the given position.
Implemented in CartesianView< RGB_T >, FrameBuffer< RGB_T, SurfaceT >, Surface< RGB_T >, Surface< RGB565 >, SurfaceMonochrome, SurfaceWithExternalBuffer< RGB_T >, WindowedSurface< RGB_T >, SurfaceBase< PixelT >, SurfaceBase< RGB565 >, and SurfaceBase< bool >.
|
pure virtual |
Returns the framebuffer height in pixels.
Implemented in CartesianView< RGB_T >, FrameBuffer< RGB_T, SurfaceT >, SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and WindowedSurface< RGB_T >.
|
inlinevirtual |
True if (x, y) lies within the currently active clip rect - always true if pushClipRect() was never called (see the default there). Exposed so code doing its own pixel math (drawArc(), the plotRoundRectCorner() helper below) can respect the same clip primitive drawing calls do.
Reimplemented in SurfaceBase< PixelT >, SurfaceBase< RGB565 >, and SurfaceBase< bool >.
|
inlinevirtual |
Restores whatever clip rect was active before the matching pushClipRect() call. Popping with no active push is a no-op.
Reimplemented in SurfaceBase< PixelT >, SurfaceBase< RGB565 >, and SurfaceBase< bool >.
|
inlinevirtual |
Restricts all subsequent drawing to the intersection of (x, y, w, h) and whatever clip rect is already active - a nested pushClipRect() call narrows further, never widens. Every drawing primitive on this surface (fillRect(), drawLine(), drawCircle(), drawSprite(), drawText(), ...) respects the currently active clip; reads (getPixel(), copySprite()) do not. Pair with a matching popClipRect() - typically wrapping one widget/container's own children so nothing they draw can spill past that widget's bounds.
Default: a no-op, so an ISurface implementation that doesn't override this (anything not deriving from SurfaceBase, which implements the actual clip stack) simply never clips - existing implementations keep drawing exactly as before.
Reimplemented in SurfaceBase< PixelT >, SurfaceBase< RGB565 >, and SurfaceBase< bool >.
|
pure virtual |
Resizes the framebuffer surface.
Implemented in CartesianView< RGB_T >, SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and FrameBuffer< RGB_T, SurfaceT >.
|
pure virtual |
Scrolls the framebuffer content by the specified offsets.
Implemented in SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and FrameBuffer< RGB_T, SurfaceT >.
|
pure virtual |
Sets a pixel at the given position.
Implemented in SurfaceBase< PixelT >, CartesianView< RGB_T >, and FrameBuffer< RGB_T, SurfaceT >.
|
pure virtual |
Provides the total data size in bytes.
Implemented in CartesianView< RGB_T >, FrameBuffer< RGB_T, SurfaceT >, Surface< RGB_T >, Surface< RGB565 >, SurfaceMonochrome, SurfaceWithExternalBuffer< RGB_T >, and WindowedSurface< RGB_T >.
|
pure virtual |
Returns the framebuffer width in pixels.
Implemented in CartesianView< RGB_T >, FrameBuffer< RGB_T, SurfaceT >, SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and WindowedSurface< RGB_T >.