COSA
An Object-Oriented Platform for Arduino Programming
Canvas::Context Class Reference

#include <Canvas.hh>

Inheritance diagram for Canvas::Context:
Inheritance graph
Collaboration diagram for Canvas::Context:
Collaboration graph

Public Member Functions

 Context (Font *font=(Font *)&system5x7)
 
color16_t get_canvas_color () const
 
color16_t set_canvas_color (color16_t color)
 
color16_t get_pen_color () const
 
color16_t set_pen_color (color16_t color)
 
color16_t get_text_color () const
 
color16_t set_text_color (color16_t color)
 
Fontget_text_font () const
 
Fontset_text_font (Font *font)
 
uint8_t get_text_scale () const
 
uint8_t set_text_scale (uint8_t scale)
 
void get_cursor (uint16_t &x, uint16_t &y) const
 
void set_cursor (uint16_t x, uint16_t y)
 
void move_cursor (int16_t dx, int16_t dy)
 

Protected Attributes

color16_t m_pen_color
 Current foreground color. More...
 
color16_t m_canvas_color
 Current background color. More...
 
color16_t m_text_color
 Current text color. More...
 
uint8_t m_text_scale
 Current text scale. More...
 
Fontm_font
 Current font. More...
 
pos16_t m_cursor
 Current cursor position. More...
 

Detailed Description

Drawing context; canvas, pen and text color. Font and text scale.

Definition at line 141 of file Canvas.hh.

Constructor & Destructor Documentation

Canvas::Context::Context ( Font font = (Font*) &system5x7)
inline

Construct a drawing context with default pen color(BLACK), canvas color(WHITE), text color(BLACK), text scale(1), and cursor at (0, 0).

Parameters
[in]fontdefault is the system font.
Precondition
font != 0

Definition at line 150 of file Canvas.hh.

Member Function Documentation

color16_t Canvas::Context::get_canvas_color ( ) const
inline

Get context canvas color.

Returns
color.

Definition at line 164 of file Canvas.hh.

void Canvas::Context::get_cursor ( uint16_t &  x,
uint16_t &  y 
) const
inline

Get context cursor position.

Parameters
[out]x.
[out]y.

Definition at line 271 of file Canvas.hh.

color16_t Canvas::Context::get_pen_color ( ) const
inline

Get context drawing color.

Returns
color.

Definition at line 185 of file Canvas.hh.

color16_t Canvas::Context::get_text_color ( ) const
inline

Get context text color.

Returns
color.

Definition at line 206 of file Canvas.hh.

Font* Canvas::Context::get_text_font ( ) const
inline

Get context text font.

Definition at line 226 of file Canvas.hh.

uint8_t Canvas::Context::get_text_scale ( ) const
inline

Get context text scale.

Returns
text scale.

Definition at line 248 of file Canvas.hh.

void Canvas::Context::move_cursor ( int16_t  dx,
int16_t  dy 
)
inline

Move context cursor to delta position.

Parameters
[in]dx.
[in]dy.

Definition at line 293 of file Canvas.hh.

color16_t Canvas::Context::set_canvas_color ( color16_t  color)
inline

Set context canvas color. Return previous color.

Parameters
[in]color.
Returns
previous color.

Definition at line 174 of file Canvas.hh.

void Canvas::Context::set_cursor ( uint16_t  x,
uint16_t  y 
)
inline

Set context cursor position.

Parameters
[in]x.
[in]y.

Definition at line 282 of file Canvas.hh.

color16_t Canvas::Context::set_pen_color ( color16_t  color)
inline

Set context drawing color. Return previous color.

Parameters
[in]color
Returns
previous color.

Definition at line 195 of file Canvas.hh.

color16_t Canvas::Context::set_text_color ( color16_t  color)
inline

Set context text color. Return previous color.

Parameters
[in]color.
Returns
previous color.

Definition at line 216 of file Canvas.hh.

Font* Canvas::Context::set_text_font ( Font font)
inline

Set context text font. Return previous color.

Parameters
[in]font.
Returns
previous font.
Precondition
font != 0.

Definition at line 237 of file Canvas.hh.

uint8_t Canvas::Context::set_text_scale ( uint8_t  scale)
inline

Set context text scale (1..n). Return previous text scale.

Parameters
[in]scale.
Returns
previous scale.
Precondition
scale > 0.

Definition at line 259 of file Canvas.hh.

Member Data Documentation

color16_t Canvas::Context::m_canvas_color
protected

Current background color.

Definition at line 301 of file Canvas.hh.

pos16_t Canvas::Context::m_cursor
protected

Current cursor position.

Definition at line 305 of file Canvas.hh.

Font* Canvas::Context::m_font
protected

Current font.

Definition at line 304 of file Canvas.hh.

color16_t Canvas::Context::m_pen_color
protected

Current foreground color.

Definition at line 300 of file Canvas.hh.

color16_t Canvas::Context::m_text_color
protected

Current text color.

Definition at line 302 of file Canvas.hh.

uint8_t Canvas::Context::m_text_scale
protected

Current text scale.

Definition at line 303 of file Canvas.hh.


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