GUI: Canvas API. More...
Go to the source code of this file.
Data Structures | |
struct | CanvasFontParameters |
Font parameters. More... | |
Typedefs | |
typedef struct Canvas | Canvas |
Canvas anonymous structure. | |
Enumerations | |
enum | Color { ColorWhite = 0x00 , ColorBlack = 0x01 , ColorXOR = 0x02 } |
Color enumeration. | |
enum | Font { FontPrimary , FontSecondary , FontKeyboard , FontBigNumbers , FontTotalNumber } |
Fonts enumeration. | |
enum | Align { AlignLeft , AlignRight , AlignTop , AlignBottom , AlignCenter } |
Alignment enumeration. | |
enum | CanvasOrientation { CanvasOrientationHorizontal , CanvasOrientationHorizontalFlip , CanvasOrientationVertical , CanvasOrientationVerticalFlip } |
Canvas Orientation. | |
enum | CanvasDirection { CanvasDirectionLeftToRight , CanvasDirectionTopToBottom , CanvasDirectionRightToLeft , CanvasDirectionBottomToTop } |
Font Direction. | |
enum | IconFlip { IconFlipNone , IconFlipHorizontal , IconFlipVertical , IconFlipBoth } |
Icon flip. | |
enum | IconRotation { IconRotation0 , IconRotation90 , IconRotation180 , IconRotation270 } |
Icon rotation. | |
Functions | |
void | canvas_reset (Canvas *canvas) |
Reset canvas drawing tools configuration. | |
void | canvas_commit (Canvas *canvas) |
Commit canvas. | |
size_t | canvas_width (const Canvas *canvas) |
Get Canvas width. | |
size_t | canvas_height (const Canvas *canvas) |
Get Canvas height. | |
size_t | canvas_current_font_height (const Canvas *canvas) |
Get current font height. | |
const CanvasFontParameters * | canvas_get_font_params (const Canvas *canvas, Font font) |
Get font parameters. | |
void | canvas_clear (Canvas *canvas) |
Clear canvas. | |
void | canvas_set_color (Canvas *canvas, Color color) |
Set drawing color. | |
void | canvas_set_font_direction (Canvas *canvas, CanvasDirection dir) |
Set font swap Argument String Rotation Description. | |
void | canvas_invert_color (Canvas *canvas) |
Invert drawing color. | |
void | canvas_set_font (Canvas *canvas, Font font) |
Set drawing font. | |
void | canvas_set_custom_u8g2_font (Canvas *canvas, const uint8_t *font) |
Set custom drawing font. | |
void | canvas_draw_str (Canvas *canvas, int32_t x, int32_t y, const char *str) |
Draw string at position of baseline defined by x, y. | |
void | canvas_draw_str_aligned (Canvas *canvas, int32_t x, int32_t y, Align horizontal, Align vertical, const char *str) |
Draw aligned string defined by x, y. | |
uint16_t | canvas_string_width (Canvas *canvas, const char *str) |
Get string width. | |
size_t | canvas_glyph_width (Canvas *canvas, uint16_t symbol) |
Get glyph width. | |
void | canvas_draw_bitmap (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height, const uint8_t *compressed_bitmap_data) |
Draw bitmap picture at position defined by x,y. | |
void | canvas_draw_icon_ex (Canvas *canvas, int32_t x, int32_t y, const Icon *icon, IconRotation rotation) |
Draw icon at position defined by x,y with rotation and flip. | |
void | canvas_draw_icon_animation (Canvas *canvas, int32_t x, int32_t y, IconAnimation *icon_animation) |
Draw animation at position defined by x,y. | |
void | canvas_draw_icon (Canvas *canvas, int32_t x, int32_t y, const Icon *icon) |
Draw icon at position defined by x,y. | |
void | canvas_draw_xbm (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height, const uint8_t *bitmap) |
Draw XBM bitmap. | |
void | canvas_draw_xbm_ex (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height, IconRotation rotation, const uint8_t *bitmap_data) |
Draw rotated XBM bitmap. | |
void | canvas_draw_dot (Canvas *canvas, int32_t x, int32_t y) |
Draw dot at x,y. | |
void | canvas_draw_box (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height) |
Draw box of width, height at x,y. | |
void | canvas_draw_frame (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height) |
Draw frame of width, height at x,y. | |
void | canvas_draw_line (Canvas *canvas, int32_t x1, int32_t y1, int32_t x2, int32_t y2) |
Draw line from x1,y1 to x2,y2. | |
void | canvas_draw_circle (Canvas *canvas, int32_t x, int32_t y, size_t radius) |
Draw circle at x,y with radius r. | |
void | canvas_draw_disc (Canvas *canvas, int32_t x, int32_t y, size_t radius) |
Draw disc at x,y with radius r. | |
void | canvas_draw_triangle (Canvas *canvas, int32_t x, int32_t y, size_t base, size_t height, CanvasDirection dir) |
Draw triangle with given base and height lengths and their intersection coordinate. | |
void | canvas_draw_glyph (Canvas *canvas, int32_t x, int32_t y, uint16_t ch) |
Draw glyph. | |
void | canvas_set_bitmap_mode (Canvas *canvas, bool alpha) |
Set transparency mode. | |
void | canvas_draw_rframe (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height, size_t radius) |
Draw rounded-corner frame of width, height at x,y, with round value radius. | |
void | canvas_draw_rbox (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height, size_t radius) |
Draw rounded-corner box of width, height at x,y, with round value raduis. | |
GUI: Canvas API.
void canvas_clear | ( | Canvas * | canvas | ) |
Clear canvas.
canvas | Canvas instance |
void canvas_commit | ( | Canvas * | canvas | ) |
Commit canvas.
Send buffer to display
canvas | Canvas instance |
size_t canvas_current_font_height | ( | const Canvas * | canvas | ) |
Get current font height.
canvas | Canvas instance |
void canvas_draw_bitmap | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | width, | ||
size_t | height, | ||
const uint8_t * | compressed_bitmap_data ) |
Draw bitmap picture at position defined by x,y.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
width | width of bitmap |
height | height of bitmap |
compressed_bitmap_data | compressed bitmap data |
void canvas_draw_box | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | width, | ||
size_t | height ) |
Draw box of width, height at x,y.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
width | box width |
height | box height |
void canvas_draw_circle | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | radius ) |
Draw circle at x,y with radius r.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
radius | radius |
void canvas_draw_disc | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | radius ) |
Draw disc at x,y with radius r.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
radius | radius |
void canvas_draw_dot | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y ) |
Draw dot at x,y.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
void canvas_draw_frame | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | width, | ||
size_t | height ) |
Draw frame of width, height at x,y.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
width | frame width |
height | frame height |
void canvas_draw_glyph | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
uint16_t | ch ) |
Draw glyph.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
ch | character |
Draw icon at position defined by x,y.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
icon | Icon instance |
void canvas_draw_icon_animation | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
IconAnimation * | icon_animation ) |
Draw animation at position defined by x,y.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
icon_animation | IconAnimation instance |
void canvas_draw_icon_ex | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
const Icon * | icon, | ||
IconRotation | rotation ) |
Draw icon at position defined by x,y with rotation and flip.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
icon | Icon instance |
rotation | IconRotation |
void canvas_draw_line | ( | Canvas * | canvas, |
int32_t | x1, | ||
int32_t | y1, | ||
int32_t | x2, | ||
int32_t | y2 ) |
Draw line from x1,y1 to x2,y2.
canvas | Canvas instance |
x1 | x1 coordinate |
y1 | y1 coordinate |
x2 | x2 coordinate |
y2 | y2 coordinate |
void canvas_draw_rbox | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | width, | ||
size_t | height, | ||
size_t | radius ) |
Draw rounded-corner box of width, height at x,y, with round value raduis.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
width | box width |
height | box height |
radius | box corner radius |
void canvas_draw_rframe | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | width, | ||
size_t | height, | ||
size_t | radius ) |
Draw rounded-corner frame of width, height at x,y, with round value radius.
canvas | Canvas instance |
x | x coordinate |
y | y coordinate |
width | frame width |
height | frame height |
radius | frame corner radius |
void canvas_draw_str | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
const char * | str ) |
Draw string at position of baseline defined by x, y.
canvas | Canvas instance |
x | anchor point x coordinate |
y | anchor point y coordinate |
str | C-string |
void canvas_draw_str_aligned | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
Align | horizontal, | ||
Align | vertical, | ||
const char * | str ) |
Draw aligned string defined by x, y.
Align calculated from position of baseline, string width and ascent (height of the glyphs above the baseline)
canvas | Canvas instance |
x | anchor point x coordinate |
y | anchor point y coordinate |
horizontal | horizontal alignment |
vertical | vertical alignment |
str | C-string |
void canvas_draw_triangle | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | base, | ||
size_t | height, | ||
CanvasDirection | dir ) |
Draw triangle with given base and height lengths and their intersection coordinate.
canvas | Canvas instance |
x | x coordinate of base and height intersection |
y | y coordinate of base and height intersection |
base | length of triangle side |
height | length of triangle height |
dir | CanvasDirection triangle orientation |
void canvas_draw_xbm | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | width, | ||
size_t | height, | ||
const uint8_t * | bitmap ) |
Draw XBM bitmap.
canvas | Canvas instance | |
x | x coordinate | |
y | y coordinate | |
[in] | width | bitmap width |
[in] | height | bitmap height |
bitmap | pointer to XBM bitmap data |
void canvas_draw_xbm_ex | ( | Canvas * | canvas, |
int32_t | x, | ||
int32_t | y, | ||
size_t | width, | ||
size_t | height, | ||
IconRotation | rotation, | ||
const uint8_t * | bitmap_data ) |
Draw rotated XBM bitmap.
canvas | Canvas instance | |
x | x coordinate | |
y | y coordinate | |
[in] | width | bitmap width |
[in] | height | bitmap height |
[in] | rotation | bitmap rotation |
bitmap_data | pointer to XBM bitmap data |
const CanvasFontParameters * canvas_get_font_params | ( | const Canvas * | canvas, |
Font | font ) |
Get font parameters.
canvas | Canvas instance |
font | Font |
size_t canvas_glyph_width | ( | Canvas * | canvas, |
uint16_t | symbol ) |
Get glyph width.
canvas | Canvas instance | |
[in] | symbol | character |
size_t canvas_height | ( | const Canvas * | canvas | ) |
Get Canvas height.
canvas | Canvas instance |
void canvas_invert_color | ( | Canvas * | canvas | ) |
Invert drawing color.
canvas | Canvas instance |
void canvas_reset | ( | Canvas * | canvas | ) |
Reset canvas drawing tools configuration.
canvas | Canvas instance |
void canvas_set_bitmap_mode | ( | Canvas * | canvas, |
bool | alpha ) |
Set transparency mode.
canvas | Canvas instance |
alpha | transparency mode |
Set drawing color.
canvas | Canvas instance |
color | Color |
void canvas_set_custom_u8g2_font | ( | Canvas * | canvas, |
const uint8_t * | font ) |
Set custom drawing font.
canvas | Canvas instance |
font | Pointer to u8g2 const uint8_t* font array |
Set drawing font.
canvas | Canvas instance |
font | Font |
void canvas_set_font_direction | ( | Canvas * | canvas, |
CanvasDirection | dir ) |
Set font swap Argument String Rotation Description.
canvas | Canvas instance |
dir | Direction font |
uint16_t canvas_string_width | ( | Canvas * | canvas, |
const char * | str ) |
Get string width.
canvas | Canvas instance |
str | C-string |
size_t canvas_width | ( | const Canvas * | canvas | ) |
Get Canvas width.
canvas | Canvas instance |