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

#include <Canvas.hh>

Inheritance diagram for Canvas::Element:
Inheritance graph
Collaboration diagram for Canvas::Element:
Collaboration graph

Public Member Functions

 Element (Canvas *canvas, 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

Canvasm_canvas
 
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

Canvas drawing elements; base class for larger drawing structure that requires a drawing context. See Textbox() for an example.

Definition at line 312 of file Canvas.hh.

Constructor & Destructor Documentation

Canvas::Element::Element ( Canvas canvas,
Font font = (Font*) &system5x7 
)
inline

Construct an element with the default context on the given canvas.

Parameters
[in]canvas.
[in]font.

Definition at line 320 of file Canvas.hh.

Member Function Documentation

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

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
inlineinherited

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
inlineinherited

Get context drawing color.

Returns
color.

Definition at line 185 of file Canvas.hh.

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

Get context text color.

Returns
color.

Definition at line 206 of file Canvas.hh.

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

Get context text font.

Definition at line 226 of file Canvas.hh.

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

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 
)
inlineinherited

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)
inlineinherited

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 
)
inlineinherited

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)
inlineinherited

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)
inlineinherited

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)
inlineinherited

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)
inlineinherited

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

Canvas* Canvas::Element::m_canvas
protected

Definition at line 326 of file Canvas.hh.

color16_t Canvas::Context::m_canvas_color
protectedinherited

Current background color.

Definition at line 301 of file Canvas.hh.

pos16_t Canvas::Context::m_cursor
protectedinherited

Current cursor position.

Definition at line 305 of file Canvas.hh.

Font* Canvas::Context::m_font
protectedinherited

Current font.

Definition at line 304 of file Canvas.hh.

color16_t Canvas::Context::m_pen_color
protectedinherited

Current foreground color.

Definition at line 300 of file Canvas.hh.

color16_t Canvas::Context::m_text_color
protectedinherited

Current text color.

Definition at line 302 of file Canvas.hh.

uint8_t Canvas::Context::m_text_scale
protectedinherited

Current text scale.

Definition at line 303 of file Canvas.hh.


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