|
| | SurfaceBase ()=default |
| | Default constructor.
|
| |
| | SurfaceBase (size_t width, size_t height, IFont< PixelT > &font) |
| | Construct with width, height, and font.
|
| |
| bool | begin () |
| | Initializes the surface by resizing it to the current dimensions.
|
| |
| void | end () |
| | Clears the surface and releases any allocated resources.
|
| |
| | ~SurfaceBase () override=default |
| | Virtual destructor.
|
| |
| void | setPixel (size_t x, size_t y, PixelT color) override=0 |
| | Abstract method: set a pixel at (x, y) to the specified color.
|
| |
| PixelT | getPixel (size_t x, size_t y) const override=0 |
| | Abstract method: get the pixel color at (x, y).
|
| |
| void | setFont (IFont< PixelT > &font) |
| | Set the font for text rendering.
|
| |
| IFont< PixelT > & | font () override |
| | Get the current font (mutable).
|
| |
| const IFont< PixelT > & | font () const |
| | Get the current font (const).
|
| |
| bool | resize (size_t newWidth, size_t newHeight) override |
| | Resize the surface to new dimensions.
|
| |
| size_t | width () const override |
| | Get the width of the surface.
|
| |
| size_t | height () const override |
| | Get the height of the surface.
|
| |
| virtual bool | resizeBuffer (size_t, size_t)=0 |
| |
| void | clear (PixelT color=PixelT()) override |
| | Clears the framebuffer with a single color.
|
| |
| void | scroll (int dx, int dy) |
| | Scroll the surface content by (dx, dy) pixels.
|
| |
| void | drawLine (size_t x0, size_t y0, size_t x1, size_t y1, PixelT color) override |
| | Draw a line from (x0, y0) to (x1, y1) with the given color.
|
| |
| void | drawRect (size_t x, size_t y, size_t w, size_t h, PixelT color) override |
| | Draw a rectangle outline at (x, y) with width w, height h, and color.
|
| |
| void | fillRect (size_t x, size_t y, size_t w, size_t h, PixelT color) override |
| | Fill a rectangle at (x, y) with width w, height h, and color.
|
| |
| void | drawCircle (size_t x, size_t y, size_t r, PixelT color) override |
| | Draw a circle outline centered at (x, y) with radius r and color.
|
| |
| void | fillCircle (size_t x, size_t y, size_t r, PixelT color) override |
| | Fill a circle centered at (x, y) with radius r and color.
|
| |
| void | drawSprite (size_t x, size_t y, const ISurface< PixelT > &sprite, PixelT invisibleColor=PixelT()) override |
| | Draw a sprite at (x, y), skipping pixels matching invisibleColor.
|
| |
| void | clearSprite (size_t x, size_t y, ISurface< PixelT > &sprite, PixelT clearColor=PixelT()) override |
| | Clear the region covered by a sprite at (x, y) to clearColor.
|
| |
| void | copySprite (size_t x, size_t y, const ISurface< PixelT > &sprite) override |
| | Copy the framebuffer region at (x, y) into the sprite.
|
| |
| void | drawText (int16_t x, int16_t y, const char *text, PixelT foreground, PixelT background=PixelT(), bool opaque=false, uint8_t scale=1, uint8_t spacing=1, uint8_t lineSpacing=1) override |
| |
| LinePrinter< PixelT > & | linePrinter () |
| | Get the line printer for this surface.
|
| |
| bool | isInBounds (size_t x, size_t y) const |
| | Returns true if (x, y) is within the surface bounds.
|
| |
| void | setPixelClipped (size_t x, size_t y, PixelT color) |
| | Set a pixel only if (x, y) is in bounds.
|
| |
| void | drawHorizontalLineClipped (int x0, int x1, int y, PixelT color) |
| | Draw a horizontal line from x0 to x1 at y, clipped to bounds.
|
| |
| 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, PixelT color)=0 |
| | Sets a pixel at the given position.
|
| |
| virtual PixelT | 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 (PixelT color=PixelT(0))=0 |
| | Clears the framebuffer with a single color.
|
| |
| virtual void | drawLine (size_t x0, size_t y0, size_t x1, size_t y1, PixelT color)=0 |
| | Draws a line between two points.
|
| |
| virtual void | drawRect (size_t x, size_t y, size_t w, size_t h, PixelT color)=0 |
| | Draws a rectangle outline.
|
| |
| virtual void | fillRect (size_t x, size_t y, size_t w, size_t h, PixelT color)=0 |
| | Fills a rectangle.
|
| |
| virtual void | drawCircle (size_t x, size_t y, size_t r, PixelT color)=0 |
| | Draws a circle outline.
|
| |
| virtual void | fillCircle (size_t x, size_t y, size_t r, PixelT color)=0 |
| | Fills a circle.
|
| |
| virtual void | drawSprite (size_t x, size_t y, const ISurface< PixelT > &sprite, PixelT invisibleColor=PixelT(0))=0 |
| | Draws a sprite using an optional transparent color.
|
| |
| virtual void | clearSprite (size_t x, size_t y, ISurface< PixelT > &sprite, PixelT clearColor=PixelT(0))=0 |
| | Clears the area covered by a sprite.
|
| |
| virtual void | copySprite (size_t x, size_t y, const ISurface< PixelT > &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, PixelT foreground, PixelT background=PixelT(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< PixelT > & | 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.
|
| |
template<typename PixelT>
class tinygpu::SurfaceBase< PixelT >
Base class for 2D surfaces with drawing and text rendering support.
SurfaceBase provides common logic for managing surface dimensions, font handling, and basic geometry operations. It is intended to be subclassed by concrete surface implementations that provide pixel storage and access (e.g., Surface, SurfaceMonochrome).
- Template Parameters
-
| PixelT | The pixel color type (e.g., RGB565, bool, etc.) |