15#define FONT_WIDTH_INDEX 0
17#define FONT_HEIGHT_INDEX 1
21#include "pico/stdlib.h"
57extern std::map<ColorIndex, uint16_t> color565_palette;
111 const unsigned char *
font{
nullptr};
180 const ColorIndex color = ColorIndex::WHITE) = 0;
188 void create_canvas_buffer();
211 void create_canvas_buffer();
234 void create_canvas_buffer();
262 void create_canvas_buffer();
CanvasFormat
the format of the canvas
Definition canvas.h:61
@ MONO_HLSB
monochrome canvas, pixel arranged horizontally, LSB is left pixel
Definition canvas.h:67
@ RGB_COLOR_INDEX_8b
color canvas, 8-bit/pixel coded according to ColorIndex in color565_palette. Converted to RGB565 just...
Definition canvas.h:73
@ MONO_VLSB
monochrome canvas, pixel arranged vertically, LSB is top pixel.
Definition canvas.h:64
@ MONO_HMSB
monochrome canvas, pixel arranged horizontally, MSB is left pixel
Definition canvas.h:70
@ RGB565_16b
color canvas, 16bits/pixel arranged 5b-red,6b-green,5b-blue stored in buffer. This is to allow the us...
Definition canvas.h:76
ColorIndex
define the code value for color
Definition canvas.h:27
void draw_pixel(const int x, const int y, const ColorIndex color=ColorIndex::WHITE)
the graphic primitive to draw a pixel
Definition canvas.cpp:93
void fill_canvas_with_color(ColorIndex color)
fill the canvas buffer with 0x00 (i.e. BLACK) of 0xFF (WHITE)
Definition canvas.cpp:85
CanvasHMSB(uint8_t canvas_width_pixel, uint8_t canvas_height_pixel)
constructor for CanvasHMSB
Definition canvas.cpp:68
The canvas is a virtual memory in which the widget draws.
Definition canvas.h:129
size_t canvas_buffer_size_byte
the size (in bytes) of the buffer
Definition canvas.h:153
uint16_t * canvas_16buffer
the 16bit canvasbuffer
Definition canvas.h:162
virtual void create_canvas_buffer()=0
Create a canvas buffer object.
CanvasFormat canvas_format
the actual format of the canvas
Definition canvas.h:133
virtual void draw_pixel(const int x, const int y, const ColorIndex color=ColorIndex::WHITE)=0
the graphic primitive to draw a pixel
ColorIndex bg_color
a copy of the widget background color
Definition canvas.h:137
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:33
uint8_t * canvas_buffer
the 8bit canvas buffer
Definition canvas.h:159
size_t canvas_buffer_size_pixel
the size (in pixel) of the buffer
Definition canvas.h:156
ColorIndex fg_color
a copy of the widget foreground color
Definition canvas.h:135
virtual void clear_canvas_buffer()
fill the canvas buffer with 0x00
Definition canvas.cpp:51
uint8_t canvas_height_pixel
the height (in pixel) of the canvas and also of those of the associated widget
Definition canvas.h:150
uint8_t canvas_width_pixel
the width (in pixel) of the canvas and also of those of the associated widget
Definition canvas.h:147
CanvasRGB(uint8_t canvas_width_pixel, uint8_t canvas_height_pixel)
Construct a new Canvas R G B object.
Definition canvas.cpp:176
void fill_canvas_with_color(ColorIndex color)
fill the canvas buffer with the given color index
Definition canvas.cpp:194
void draw_pixel(const int x, const int y, const ColorIndex color=ColorIndex::WHITE)
the graphic primitive to draw a pixel
Definition canvas.cpp:199
void draw_pixel(const int x, const int y, const ColorIndex color=ColorIndex::WHITE)
the graphic primitive to draw a pixel
Definition canvas.cpp:250
void fill_canvas_with_color(ColorIndex color)
fill the canvas buffer with the given color index
Definition canvas.cpp:242
CanvasTrueRGB(uint8_t canvas_width_pixel, uint8_t canvas_height_pixel)
Construct a new Canvas R G B object.
Definition canvas.cpp:219
virtual void clear_canvas_buffer()
fill the 16bit canvas buffer with 0x00
Definition canvas.cpp:237
void fill_canvas_with_color(ColorIndex color)
fill the canvas buffer with 0x00 (i.e. BLACK) of 0xFF (WHITE)
Definition canvas.cpp:140
CanvasVLSB(uint8_t canvas_width_pixel, uint8_t canvas_height_pixel)
Construct a new Canvas V L S B object.
Definition canvas.cpp:122
void draw_pixel(const int x, const int y, const ColorIndex color=ColorIndex::WHITE)
the graphic primitive to draw a pixel
Definition canvas.cpp:148
the data structure used to configure textual widget
Definition canvas.h:100
uint8_t widget_anchor_x
the x_axis anchor of the widget
Definition canvas.h:106
ColorIndex fg_color
The foreground color, default to WHITE.
Definition canvas.h:115
bool wrap
Wrap flag : if true, text wrap to the next line when end of line is reached.
Definition canvas.h:119
ColorIndex bg_color
The background color, default to BLACK.
Definition canvas.h:117
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:111
bool widget_with_border
a flag that indicates if the widget has a 1-pixel width border
Definition canvas.h:123
uint8_t number_of_column
The max number of line with respect to frame height and font height.
Definition canvas.h:102
uint8_t tab_size
The number of space that ASCII character HT (aka TAB , "\t", 0x9) generates, default to 2.
Definition canvas.h:113
uint8_t widget_anchor_y
the y-axis anchor of the widget
Definition canvas.h:108
uint8_t number_of_line
The max number of column with respect to frame width and font width.
Definition canvas.h:104
bool auto_next_char
auto_next_char flag : if true each char steps one position after being written.
Definition canvas.h:121