Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ersa::ui::Canvas Class Referenceabstract

#include <canvas.h>

Public Member Functions

virtual ~Canvas ()=default
 
virtual int width () const =0
 
virtual int height () const =0
 
virtual void clear (Color color=Color::Black)=0
 
virtual void drawPixel (int x, int y, Color color=Color::White)=0
 
virtual void drawLine (int x1, int y1, int x2, int y2, Color color=Color::White)=0
 
virtual void drawRect (int x, int y, int w, int h, Color color=Color::White)=0
 
virtual void fillRect (int x, int y, int w, int h, Color color=Color::White)=0
 
virtual void drawText (int x, int y, const char *text, Color color=Color::White)=0
 

Detailed Description

Small renderer contract for canvas-oriented watchfaces.

Canvas is intentionally narrower than a vendor graphics library: it exposes logical pixels, primitive geometry, and text while hiding framebuffer and panel details. It is useful for portable watchface code; the fuller display HAL is used when an app needs font selection or refresh-specific behavior.

Constructor & Destructor Documentation

◆ ~Canvas()

virtual ersa::ui::Canvas::~Canvas ( )
virtualdefault

Allow concrete canvases to be destroyed through this interface.

Member Function Documentation

◆ clear()

virtual void ersa::ui::Canvas::clear ( Color  color = Color::Black)
pure virtual

Fill the entire canvas; no hardware refresh is implied.

◆ drawLine()

virtual void ersa::ui::Canvas::drawLine ( int  x1,
int  y1,
int  x2,
int  y2,
Color  color = Color::White 
)
pure virtual

Rasterize a line between logical endpoints.

◆ drawPixel()

virtual void ersa::ui::Canvas::drawPixel ( int  x,
int  y,
Color  color = Color::White 
)
pure virtual

Set one logical pixel, clipping or ignoring coordinates outside bounds.

◆ drawRect()

virtual void ersa::ui::Canvas::drawRect ( int  x,
int  y,
int  w,
int  h,
Color  color = Color::White 
)
pure virtual

Draw a rectangle outline with the supplied origin and extent.

◆ drawText()

virtual void ersa::ui::Canvas::drawText ( int  x,
int  y,
const char *  text,
Color  color = Color::White 
)
pure virtual

Draw text at the backend-defined baseline convention.

◆ fillRect()

virtual void ersa::ui::Canvas::fillRect ( int  x,
int  y,
int  w,
int  h,
Color  color = Color::White 
)
pure virtual

Fill a rectangle in the framebuffer.

◆ height()

virtual int ersa::ui::Canvas::height ( ) const
pure virtual

Return logical height in pixels for layout calculations.

◆ width()

virtual int ersa::ui::Canvas::width ( ) const
pure virtual

Return logical width in pixels for layout calculations.


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