15#define FONT_WIDTH_INDEX 0
17#define FONT_HEIGHT_INDEX 1
21#include "pico/stdlib.h"
56extern std::map<ColorIndex, uint16_t> color565_palette;
103 const unsigned char *
font{
nullptr};
165 const ColorIndex color = ColorIndex::WHITE) = 0;
173 void create_canvas_buffer();
196 void create_canvas_buffer();
221 void create_canvas_buffer();
CanvasFormat
the format of the canvas
Definition canvas.h:60
@ MONO_HLSB
monochrome canvas, pixel arranged horizontally, LSB is left pixel
Definition canvas.h:64
@ RGB565
color canvas, 16bits/pixel arranged 5b-red,6b-green,5b-blue
Definition canvas.h:68
@ MONO_VLSB
monochrome canvas, pixel arranged vertically, LSB is top pixel
Definition canvas.h:62
@ MONO_HMSB
monochrome canvas, pixel arranged horizontally, MSB is left pixel
Definition canvas.h:66
ColorIndex
define the code value for color
Definition canvas.h:26
void draw_pixel(const int x, const int y, const ColorIndex color=ColorIndex::WHITE)
the graphic primitive to draw a pixel
Definition canvas.cpp:74
void fill_canvas_with_color(ColorIndex color)
fill the canvas buffer with 0x00 (i.e. BLACK) of 0xFF (WHITE)
Definition canvas.cpp:66
CanvasHMSB(uint8_t canvas_width_pixel, uint8_t canvas_height_pixel)
constructor for CanvasHMSB
Definition canvas.cpp:55
The canvas is a virtual memory in which the widget draws.
Definition canvas.h:121
size_t canvas_buffer_size
the size (in bytes) of the buffer
Definition canvas.h:145
virtual void create_canvas_buffer()=0
Create a canvas buffer object.
CanvasFormat canvas_format
the actual format of the canvas
Definition canvas.h:125
virtual void draw_pixel(const int x, const int y, const ColorIndex color=ColorIndex::WHITE)=0
the graphic primitive to draw a pixel
virtual void fill_canvas_with_color(ColorIndex color)=0
fill the canvas with a given color
Canvas(uint8_t canvas_width_pixel, uint8_t canvas_height_pixel)
Construct a new Canvas object.
Definition canvas.cpp:31
uint8_t * canvas_buffer
the buffer
Definition canvas.h:148
void clear_canvas_buffer()
fill the canvas buffer with 0x00
Definition canvas.cpp:42
ColorIndex canvas_bg_color
a copy of the widget background color
Definition canvas.h:129
uint8_t canvas_height_pixel
the height (in pixel) of the canvas and also of those of the associated widget
Definition canvas.h:142
uint8_t canvas_width_pixel
the width (in pixel) of the canvas and also of those of the associated widget
Definition canvas.h:139
ColorIndex canvas_fg_color
a copy of the widget foreground color
Definition canvas.h:127
CanvasRGB(uint8_t canvas_width_pixel, uint8_t canvas_height_pixel)
Construct a new Canvas R G B object.
Definition canvas.cpp:143
void fill_canvas_with_color(ColorIndex color)
fill the canvas buffer with the given color index
Definition canvas.cpp:155
void draw_pixel(const int x, const int y, const ColorIndex color=ColorIndex::WHITE)
the graphic primitive to draw a pixel
Definition canvas.cpp:160
void fill_canvas_with_color(ColorIndex color)
fill the canvas buffer with 0x00 (i.e. BLACK) of 0xFF (WHITE)
Definition canvas.cpp:111
CanvasVLSB(uint8_t canvas_width_pixel, uint8_t canvas_height_pixel)
Construct a new Canvas V L S B object.
Definition canvas.cpp:99
void draw_pixel(const int x, const int y, const ColorIndex color=ColorIndex::WHITE)
the graphic primitive to draw a pixel
Definition canvas.cpp:119
the data structure used to configure textual widget
Definition canvas.h:92
uint8_t widget_anchor_x
the x_axis anchor of the widget
Definition canvas.h:98
ColorIndex fg_color
The foreground color, default to WHITE.
Definition canvas.h:107
bool wrap
Wrap flag : if true, text wrap to the next line when end of line is reached.
Definition canvas.h:111
ColorIndex bg_color
The background color, default to BLACK.
Definition canvas.h:109
const unsigned char * font
The font used. Current font are defined according to IBM CP437. The font files are derived from https...
Definition canvas.h:103
bool widget_with_border
a flag that indicates if the widget has a 1-pixel width border
Definition canvas.h:115
uint8_t number_of_column
The max number of line with respect to frame height and font height.
Definition canvas.h:94
uint8_t tab_size
The number of space that ASCII character HT (aka TAB , "\t", 0x9) generates, default to 2.
Definition canvas.h:105
uint8_t widget_anchor_y
the y-axis anchor of the widget
Definition canvas.h:100
uint8_t number_of_line
The max number of column with respect to frame width and font width.
Definition canvas.h:96
bool auto_next_char
auto_next_char flag : if true each char steps one position after being written.
Definition canvas.h:113