COSA
An Object-Oriented Platform for Arduino Programming
|
#include <OffScreen.hh>
Public Types | |
enum | { BLACK = 0x0000U, WHITE = 0xFFFFU, RED = 0xF800U, GREEN = 0x07E0U, BLUE = 0x001FU, YELLOW = RED + GREEN, CYAN = GREEN + BLUE, MAGENTA = RED + BLUE } |
enum | { PORTRAIT = 0, LANDSCAPE = 1 } |
enum | { END_SCRIPT = 0, CALL_SCRIPT, SET_CANVAS_COLOR, SET_PEN_COLOR, SET_TEXT_COLOR, SET_TEXT_SCALE, SET_TEXT_FONT, SET_CURSOR, MOVE_CURSOR, DRAW_BITMAP, DRAW_ICON, DRAW_PIXEL, DRAW_LINE, DRAW_POLY, DRAW_STROKE, DRAW_RECT, FILL_RECT, DRAW_ROUNDRECT, FILL_ROUNDRECT, DRAW_CIRCLE, FILL_CIRCLE, DRAW_CHAR, DRAW_STRING, FILL_SCREEN } |
Public Member Functions | |
OffScreen () | |
uint8_t * | bitmap () |
virtual bool | begin () |
virtual void | draw_pixel (uint16_t x, uint16_t y) |
virtual void | fill_screen () |
virtual bool | end () |
Context * | get_context () const |
Context * | set_context (Context *context) |
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) |
Font * | get_text_font () const |
Font * | set_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) |
color16_t | color (uint8_t red, uint8_t green, uint8_t blue) |
virtual uint8_t | get_orientation () |
virtual uint8_t | set_orientation (uint8_t direction) |
void | draw_pixel () |
virtual void | draw_bitmap (uint16_t x, uint16_t y, const uint8_t *bp, uint16_t width, uint16_t height, uint8_t scale=1) |
void | draw_bitmap (const uint8_t *bp, uint16_t width, uint16_t height, uint8_t scale=1) |
virtual void | draw_icon (uint16_t x, uint16_t y, const uint8_t *bp, uint16_t width, uint16_t height, uint8_t scale=1) |
virtual void | draw_icon (uint16_t x, uint16_t y, const uint8_t *bp, uint8_t scale=1) |
void | draw_icon (const uint8_t *bp, uint8_t scale=1) |
virtual void | draw_image (uint16_t x, uint16_t y, Image *image) |
void | draw_image (Image *image) |
virtual void | draw_line (uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) |
void | draw_line (uint16_t x1, uint16_t y1) |
virtual void | draw_vertical_line (uint16_t x, uint16_t y, uint16_t length) |
void | draw_vertical_line (uint16_t length) |
virtual void | draw_horizontal_line (uint16_t x, uint16_t y, uint16_t length) |
void | draw_horizontal_line (uint16_t length) |
virtual void | draw_poly_P (const int8_t *poly, uint8_t scale=1) |
virtual void | draw_stroke_P (const int8_t *stroke, uint8_t scale=1) |
virtual void | draw_rect (uint16_t x, uint16_t y, uint16_t width, uint16_t height) |
void | draw_rect (uint16_t width, uint16_t height) |
virtual void | fill_rect (uint16_t x, uint16_t y, uint16_t width, uint16_t height) |
void | fill_rect (uint16_t width, uint16_t height) |
virtual void | draw_roundrect (uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t radius) |
void | draw_roundrect (uint16_t width, uint16_t height, uint16_t radius) |
virtual void | fill_roundrect (uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t radius) |
void | fill_roundrect (uint16_t width, uint16_t height, uint16_t radius) |
virtual void | draw_circle (uint16_t x, uint16_t y, uint16_t radius) |
void | draw_circle (uint16_t radius) |
virtual void | fill_circle (uint16_t x, uint16_t y, uint16_t radius) |
void | fill_circle (uint16_t radius) |
virtual void | draw_char (uint16_t x, uint16_t y, char c) |
void | draw_char (char c) |
virtual void | draw_string (char *s) |
virtual void | draw_string (str_P s) |
void | run (uint8_t ix, const void_P *tab, uint8_t max) |
Static Public Member Functions | |
static color16_t | shade (color16_t color, uint8_t scale) |
static color16_t | blend (color16_t c1, color16_t c2) |
Public Attributes | |
uint16_t | WIDTH |
uint16_t | HEIGHT |
Protected Attributes | |
Context * | m_context |
uint8_t | m_direction |
Static Protected Attributes | |
static Context | context |
Off-screen canvas for drawing before copying to the canvas device. Supports monochrome, 1-bit, pixel in off-screen buffer. Minimum implementation; draw_pixel() only.
[in] | width | of canvas. |
[in] | height | of canvas. |
Definition at line 34 of file OffScreen.hh.
|
inherited |
|
inherited |
Canvas script instructions. See macro set below for arguments.
Construct off-screen canvas with given width and height.
Definition at line 39 of file OffScreen.hh.
|
inlinevirtual |
Start interaction with off-screen canvas.
Implements Canvas.
Definition at line 55 of file OffScreen.hh.
|
inline |
Get bitmap for the off-screen canvas.
Definition at line 45 of file OffScreen.hh.
|
staticinherited |
Blend the two colors.
[in] | c1. | |
[in] | c2. |
Definition at line 39 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw bitmap with current pen color. The bitmap must be stored in program memory.
[in] | x. | |
[in] | y. | |
[in] | bp. | |
[in] | width. | |
[in] | height. | |
[in] | scale. |
Definition at line 69 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw character with current text color, font and scale.
[in] | x | position. |
[in] | y | position. |
[in] | c | character. |
Definition at line 378 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw circle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | radius. |
Definition at line 247 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw horizontal line with current pen color.
[in] | x. | |
[in] | y. | |
[in] | length. |
Reimplemented in GDDRAM.
Definition at line 204 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw icon at given position with current pen color. The icon must be stored in program memory.
[in] | x. | |
[in] | y. | |
[in] | bp. | |
[in] | width. | |
[in] | height. | |
[in] | scale. |
Definition at line 105 of file Canvas.cpp.
|
virtualinherited |
Draw icon at given position with current pen color. The icon must be stored in program memory.
[in] | x. | |
[in] | y. | |
[in] | bp. | |
[in] | scale. |
Definition at line 113 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw image on canvas at given position.
[in] | x. | |
[in] | y. | |
[in] | image. |
Reimplemented in GDDRAM.
Definition at line 121 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw line with current pen color.
[in] | x0. | |
[in] | y0. | |
[in] | x1. | |
[in] | y1. |
Definition at line 167 of file Canvas.cpp.
|
inlineinherited |
|
inlinevirtual |
Set pixel according to the current pen color.
[in] | x. | |
[in] | y. |
Reimplemented from Canvas.
Definition at line 67 of file OffScreen.hh.
|
inlineinherited |
|
virtualinherited |
Draw polygon from program memory with current pen color. Vector of delta positions, terminate with 0, 0. Update cursor to end position.
[in] | poly. | |
[in] | scale. |
Definition at line 210 of file Canvas.cpp.
|
virtualinherited |
Draw rectangle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | width. | |
[in] | height. |
Definition at line 142 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw round corner rectangle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | width. | |
[in] | height. | |
[in] | radius. |
Definition at line 301 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw string in current text color, font and scale.
[in] | s | string. |
Definition at line 389 of file Canvas.cpp.
|
virtualinherited |
Draw string from program memory with current text color and font.
[in] | s | string in program memory (PSTR). |
Definition at line 397 of file Canvas.cpp.
|
virtualinherited |
Draw stroke from program memory with current pen color. Vector of delta positions, terminated with 0, 0. The cursor is moved for when both dx and dy are zero or negative. Update cursor to new position.
[in] | stroke. | |
[in] | scale. |
Definition at line 226 of file Canvas.cpp.
|
virtualinherited |
Draw vertical line with current pen color.
[in] | x. | |
[in] | y. | |
[in] | length. |
Reimplemented in GDDRAM.
Definition at line 198 of file Canvas.cpp.
|
inlineinherited |
|
inlinevirtual |
Stop sequence of interaction with off-screen device.
Implements Canvas.
Definition at line 92 of file OffScreen.hh.
|
virtualinherited |
Fill circle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | radius. |
Definition at line 280 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Fill rectangle with current pen color. Must override.
[in] | x. | |
[in] | y. | |
[in] | width. | |
[in] | height. |
Reimplemented in GDDRAM.
Definition at line 151 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Fill round corner rectangle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | width. | |
[in] | height. | |
[in] | radius. |
Definition at line 346 of file Canvas.cpp.
|
inlineinherited |
|
inlinevirtual |
Fill offscreen buffer with canvas background color.
Reimplemented from Canvas.
Definition at line 82 of file OffScreen.hh.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
virtualinherited |
Get screen orientation.
Definition at line 49 of file Canvas.cpp.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Run canvas drawing script. Table may contain sub-scripts, strings and icons. All should be in program memory. Use the support macro set to write scripts.
[in] | ix | script to run. |
[in] | tab | script table in program memory. |
[in] | max | size of script table. |
Definition at line 414 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Set screen orientation. Return previous orientation.
[in] | direction | (Canvas::LANDSCAPE/PORTRAIT). |
Reimplemented in ILI9163, ST7735, and GDDRAM.
Definition at line 55 of file Canvas.cpp.
|
inlineinherited |
|
staticinherited |
Create color shade (0..100%).
[in] | color. | |
[in] | scale. |
Definition at line 28 of file Canvas.cpp.
|
staticprotectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |