Provides simple tools to allow a screen buffer to be updated with text, boxes, etc.
Handles basic RGB for OLED/LCD RGB display, and simple mono for epaper.
Designed to allow for various SPI based display devices to be selected as part of config.
Note that the current state, graphics buffer, etc, are global, so only one display is supported.
- Includes scaled vector based font based on SAA5050 5x9 (Teletext/MODE7) with anti-aliasing.
- Includes scaled 7 segment (plus
.
and:
), with anti-aliasing - Includes simple box and line drawing
Displays with simple solid colour, such as black/white, black/red/white, etc, are handled quite simply with each pixel being one of the solid colours. The colour picked simply mapper from the RGB specified.
A simple dithering is applied on grey levels.
Anti-aliasing and alpha blending are not supported (top bit of alpha determines if plotted of not). As such italics is not recommended (text and 7 segment).
Displays with greyscale or colours allow antialiasing and alpha blending. A pixel can be set based on an RGB value - for greyscale this is mapped to a grey level.
Alpha blending is handled, mixing the new plotted pixel with the existing based on an alpha level.
Antialiasing is used for text, and 7 segment digits to improve quality, this will be added to other functions (line, circle, etc).
Sets up the display and options including all GPIOs and a number of flags.
Provide details of current display size and attriblues
Cann lock, then plot things, then unlock. Depending on the initial settings the display will be updated on unlock or on a background task (which locks while sending).
These set the current foreground and background to use. For text and 7 segment a solid background is set as a box first and then the text or 7 segment is plotted. This can be disabled by setting the same colour for foreground and background allowing plotting over the existing pixels with alpha blending. You can check current values with gfx_f
and gfx_b
.
This set a pixel based on a 32 bit value (AARRGGBB), an alpha of 0xFF is plot, 0x00 is don't plot, otherwise alpha blend (non antialiasing displays simply test top bit of alpha to plot or not plot).
gfx_pixel
plots using current foreground colour width specified alphagfx_pixel_bg
plots using current background colour width specified alphagfx_pixel_rgb
plots specified colour (RRGGBB), same as alpha 0xFFgfx_clear
plots a blend of current background and current foreground for whole display based on an alpha valuegfx_pixel_fb
plots a blend of current background and current foreground for a pixel based on an alpha value (if background/foreground same then doesgfx_pixel
)
Sets current position and alignment for other functions. You can get current values gf_x
, gfx_y
, gfx_a
.
These plot text or fixed digits. They have a number of flags and a based size. It plots at current position and alignment and moves to new position.
gfx_text
plots vector based text including a load of unicode characters - this allows newlinesgfx_7seg
plots digits, and.
or:
after a digit, and a number of letters than can be expressed using 7 segment display format
You can check size of text with gfx_text_size
and gfx_7seg_size
.
Note for text, a size
of 0 plots a non anti-aliased size 1.
If using the GFX_7SEG_SMALL_DOT
flag, a trailing C
or F
character is superscript (for temperatures).
There are various options including italic, dotty, blocky, etc.
A number of extra functions exist - these are being updated and new functions added.
sin256
a table of sin() for 90 degrees (0-255) giving value 0-255circle256
a table of x for y for a quarter circle 0-255 giving value 0-255
You can make use of the lwpng
library for processing a png and calling gfx_pixel_argb
. If you want to access the frame buffer gfx_raw_w
, gfx_raw_h
and gfx_raw_b
allow access to the raw buffer - you will need to decode pixel values depending on gfx_bpp
if you want to make a png.