TinyGPU
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ISurface< RGB_T > Class Template Referenceabstract

Abstract framebuffer and drawing interface for TinyGPU surfaces. More...

#include <ISurface.h>

Inheritance diagram for ISurface< RGB_T >:
Inheritance graph
[legend]

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 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.
 

Detailed Description

template<typename RGB_T = RGB565>
class tinygpu::ISurface< RGB_T >

Abstract framebuffer and drawing interface for TinyGPU surfaces.

Implementations expose pixel access, primitive drawing, sprite operations, and text rendering through a common API.

Note
The coordinate x=0 and y=0 corresponds to the top-left corner of the surface. The x coordinate increases to the right and the y coordinate increases downwards.

Constructor & Destructor Documentation

◆ ~ISurface()

virtual ~ISurface ( )
virtualdefault

Destroys the framebuffer interface.

Member Function Documentation

◆ begin()

virtual bool begin ( )
pure virtual

Initializes the framebuffer surface.

Implemented in SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and FrameBuffer< RGB_T, SurfaceT >.

◆ clear()

virtual void clear ( RGB_T  color = RGB_T(0))
pure virtual

Clears the framebuffer with a single color.

Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.

◆ clearSprite()

virtual void clearSprite ( size_t  x,
size_t  y,
ISurface< RGB_T > &  sprite,
RGB_T  clearColor = RGB_T(0) 
)
pure virtual

Clears the area covered by a sprite.

Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.

◆ copySprite()

virtual void copySprite ( size_t  x,
size_t  y,
const ISurface< RGB_T > &  sprite 
)
pure virtual

Copies pixels from the framebuffer into a sprite.

Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.

◆ data()

virtual const uint8_t * data ( ) const
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 >, and SurfaceMonochrome.

◆ drawCircle()

virtual void drawCircle ( size_t  x,
size_t  y,
size_t  r,
RGB_T  color 
)
pure virtual

Draws a circle outline.

Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.

◆ drawLine()

virtual void drawLine ( size_t  x0,
size_t  y0,
size_t  x1,
size_t  y1,
RGB_T  color 
)
pure virtual

Draws a line between two points.

Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.

◆ drawRect()

virtual void drawRect ( size_t  x,
size_t  y,
size_t  w,
size_t  h,
RGB_T  color 
)
pure virtual

Draws a rectangle outline.

Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.

◆ drawSprite()

virtual void drawSprite ( size_t  x,
size_t  y,
const ISurface< RGB_T > &  sprite,
RGB_T  invisibleColor = RGB_T(0) 
)
pure virtual

Draws a sprite using an optional transparent color.

Implemented in SurfaceBase< PixelT >, FrameBuffer< RGB_T, SurfaceT >, and CartesianView< RGB_T >.

◆ drawText()

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 
)
pure virtual

Draws UTF-8 text using the configured font.

Implemented in SurfaceBase< PixelT >, and FrameBuffer< RGB_T, SurfaceT >.

◆ end()

virtual void end ( )
pure virtual

Closes the framebuffer and releases resources.

Implemented in SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and FrameBuffer< RGB_T, SurfaceT >.

◆ fillCircle()

virtual void fillCircle ( size_t  x,
size_t  y,
size_t  r,
RGB_T  color 
)
pure virtual

◆ fillRect()

virtual void fillRect ( size_t  x,
size_t  y,
size_t  w,
size_t  h,
RGB_T  color 
)
pure virtual

◆ font()

virtual IFont< RGB_T > & font ( )
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 >.

◆ getPixel()

virtual RGB_T getPixel ( size_t  x,
size_t  y 
) const
pure virtual

◆ height()

virtual size_t height ( ) const
pure virtual

◆ resize()

virtual bool resize ( size_t  newWidth,
size_t  newHeight 
)
pure virtual

◆ scroll()

virtual void scroll ( int  dx,
int  dy 
)
pure virtual

Scrolls the framebuffer content by the specified offsets.

Implemented in SurfaceBase< PixelT >, SurfaceBase< RGB565 >, SurfaceBase< bool >, and FrameBuffer< RGB_T, SurfaceT >.

◆ setPixel()

virtual void setPixel ( size_t  x,
size_t  y,
RGB_T  color 
)
pure virtual

Sets a pixel at the given position.

Implemented in SurfaceBase< PixelT >, CartesianView< RGB_T >, and FrameBuffer< RGB_T, SurfaceT >.

◆ size()

virtual size_t size ( ) const
pure virtual

Provides the total data size in bytes.

Implemented in CartesianView< RGB_T >, FrameBuffer< RGB_T, SurfaceT >, Surface< RGB_T >, Surface< RGB565 >, and SurfaceMonochrome.

◆ width()

virtual size_t width ( ) const
pure virtual

The documentation for this class was generated from the following files: