A ChafaCanvas is a canvas that can render its contents as text strings.
ChafaCanvas * chafa_canvas_new (
const ChafaCanvasConfig *config);
Creates a new canvas with the specified configuration. The canvas makes a private copy of the configuration, so it will not be affected by subsequent changes.
Configuration to use or
ChafaCanvas * chafa_canvas_new_similar (
Creates a new canvas configured similarly to
void chafa_canvas_ref (
Adds a reference to
void chafa_canvas_unref (
Removes a reference from
. When remaining references drops to
zero, the canvas is freed and can no longer be used.
const ChafaCanvasConfig * chafa_canvas_peek_config (
Returns a pointer to the configuration belonging to
This can be inspected using the ChafaCanvasConfig getter
functions, but not changed.
void chafa_canvas_set_contents_rgba8 (
const guint8 *src_pixels,
Replaces pixel data of
with a copy of that found at
The source data must be in packed 8-bits-per-channel RGBA format. The
alpha value is expressed as opacity (0xff is opaque) and is not
GString * chafa_canvas_build_ansi (
Builds a UTF-8 string of ANSI sequences and symbols representing
the canvas' current contents. This can e.g. be printed to a terminal.
The exact choice of escape sequences and symbols, dimensions, etc. is
determined by the configuration assigned to
on its creation.
All output lines except for the last one will end in a newline.