File syn_gfx.h¶
FileList > display > syn_gfx.h
Go to the source code of this file
Compile-time graphics renderer abstraction. More...
#include "syn_canvas.h"
Public Types¶
| Type | Name |
|---|---|
| typedef SYN_Canvas * | SYN_GfxContext |
Macros¶
| Type | Name |
|---|---|
| define | SYN_GFX_BACKEND [**SYN\_GFX\_BACKEND\_CANVAS**](syn__gfx_8h.md#define-syn_gfx_backend_canvas)Selected graphics backend (SYN_GFX_BACKEND_CANVAS or SYN_GFX_BACKEND_DIRECT). |
| define | SYN_GFX_BACKEND_CANVAS 0 |
| define | SYN_GFX_BACKEND_DIRECT 1 |
| define | syn_gfx_bitmap (ctx, x, y, bmp, w, h, color) [**syn\_canvas\_bitmap**](syn__canvas_8c.md#function-syn_canvas_bitmap)((ctx), (x), (y), (bmp), (w), (h), (color)) |
| define | syn_gfx_char (ctx, x, y, ch, color) [**syn\_canvas\_char**](syn__canvas_8c.md#function-syn_canvas_char)((ctx), (x), (y), ([**ch**](syn__sha256_8c.md#function-ch)), (color)) |
| define | syn_gfx_circle (ctx, cx, cy, r, color) [**syn\_canvas\_circle**](syn__canvas_8c.md#function-syn_canvas_circle)((ctx), (cx), (cy), (r), (color)) |
| define | syn_gfx_circle_fill (ctx, cx, cy, r, color) [**syn\_canvas\_circle\_fill**](syn__canvas_8c.md#function-syn_canvas_circle_fill)((ctx), (cx), (cy), (r), (color)) |
| define | syn_gfx_clear (ctx) [**syn\_canvas\_clear**](syn__canvas_8c.md#function-syn_canvas_clear)(ctx) |
| define | syn_gfx_fill (ctx, color) [**syn\_canvas\_fill**](syn__canvas_8c.md#function-syn_canvas_fill)((ctx), (color)) |
| define | syn_gfx_flush (ctx) [**syn\_canvas\_flush**](syn__canvas_8c.md#function-syn_canvas_flush)(ctx)Flush the entire framebuffer to the display. |
| define | syn_gfx_flush_partial (ctx, offset, len) [**syn\_canvas\_flush\_partial**](syn__canvas_8c.md#function-syn_canvas_flush_partial)((ctx), (offset), (len))Flush a partial region of the framebuffer. |
| define | syn_gfx_font_width (ctx) ((ctx)->font ? (ctx)->font->width : 5) |
| define | syn_gfx_hline (ctx, x, y, w, color) [**syn\_canvas\_hline**](syn__canvas_8c.md#function-syn_canvas_hline)((ctx), (x), (y), (w), (color)) |
| define | syn_gfx_line (ctx, x0, y0, x1, y1, color) [**syn\_canvas\_line**](syn__canvas_8c.md#function-syn_canvas_line)((ctx), (x0), (y0), (x1), (y1), (color)) |
| define | syn_gfx_pixel (ctx, x, y, color) [**syn\_canvas\_pixel**](syn__canvas_8c.md#function-syn_canvas_pixel)((ctx), (x), (y), (color)) |
| define | syn_gfx_rect (ctx, x, y, w, h, color) [**syn\_canvas\_rect**](syn__canvas_8c.md#function-syn_canvas_rect)((ctx), (x), (y), (w), (h), (color)) |
| define | syn_gfx_rect_fill (ctx, x, y, w, h, color) [**syn\_canvas\_rect\_fill**](syn__canvas_8c.md#function-syn_canvas_rect_fill)((ctx), (x), (y), (w), (h), (color)) |
| define | syn_gfx_rect_round (ctx, x, y, w, h, r, color) [**syn\_canvas\_rect\_round**](syn__canvas_8c.md#function-syn_canvas_rect_round)((ctx), (x), (y), (w), (h), (r), (color)) |
| define | syn_gfx_rect_round_fill (ctx, x, y, w, h, r, color) /* multi line expression */ |
| define | syn_gfx_reset_clip (ctx) [**syn\_canvas\_reset\_clip**](syn__canvas_8c.md#function-syn_canvas_reset_clip)(ctx) |
| define | syn_gfx_set_clip (ctx, x, y, w, h) [**syn\_canvas\_set\_clip**](syn__canvas_8c.md#function-syn_canvas_set_clip)((ctx), (x), (y), (w), (h)) |
| define | syn_gfx_text (ctx, x, y, str, color) [**syn\_canvas\_text**](syn__canvas_8c.md#function-syn_canvas_text)((ctx), (x), (y), (str), (color)) |
| define | syn_gfx_text_height (ctx) [**syn\_canvas\_text\_height**](syn__canvas_8c.md#function-syn_canvas_text_height)(ctx) |
| define | syn_gfx_text_width (ctx, str) [**syn\_canvas\_text\_width**](syn__canvas_8c.md#function-syn_canvas_text_width)((ctx), (str)) |
| define | syn_gfx_vline (ctx, x, y, h, color) [**syn\_canvas\_vline**](syn__canvas_8c.md#function-syn_canvas_vline)((ctx), (x), (y), (h), (color)) |
Detailed Description¶
Provides a hardware-independent drawing API that the IMGUI widget layer (and user code) can call without being tied to a specific rendering backend.
The active backend is selected at compile time via the SYN_GFX_BACKEND macro in syn_config.h. If not defined, the framebuffer canvas backend (SYN_GFX_BACKEND_CANVAS) is used by default.
** **
| Macro value | Backend |
|---|---|
SYN_GFX_BACKEND_CANVAS |
Framebuffer canvas (syn_canvas) |
SYN_GFX_BACKEND_DIRECT |
Direct-draw (no framebuffer) |
All syn_gfx_* symbols resolve to direct function calls (or macros) at compile time — zero indirection overhead at runtime.
** **
// Widget / application code includes only this header:
#include "display/syn_gfx.h"
syn_gfx_clear(gfx);
syn_gfx_rect_fill(gfx, 0, 0, 40, 12, SYN_COLOR_WHITE);
syn_gfx_text(gfx, 4, 2, "Hello", SYN_COLOR_BLACK);
syn_gfx_flush(gfx);
Public Types Documentation¶
typedef SYN_GfxContext¶
Opaque graphics context — resolves to a canvas pointer.
Macro Definition Documentation¶
define SYN_GFX_BACKEND¶
Selected graphics backend (SYN_GFX_BACKEND_CANVAS or SYN_GFX_BACKEND_DIRECT).
define SYN_GFX_BACKEND_CANVAS¶
Framebuffer canvas (default)
define SYN_GFX_BACKEND_DIRECT¶
Direct-draw (no framebuffer)
define syn_gfx_bitmap¶
#define syn_gfx_bitmap (
ctx,
x,
y,
bmp,
w,
h,
color
) `syn_canvas_bitmap ((ctx), (x), (y), (bmp), (w), (h), (color))`
Draw 1-bit bitmap.
define syn_gfx_char¶
Draw single char.
define syn_gfx_circle¶
#define syn_gfx_circle (
ctx,
cx,
cy,
r,
color
) `syn_canvas_circle ((ctx), (cx), (cy), (r), (color))`
Draw circle outline.
define syn_gfx_circle_fill¶
#define syn_gfx_circle_fill (
ctx,
cx,
cy,
r,
color
) `syn_canvas_circle_fill ((ctx), (cx), (cy), (r), (color))`
Draw filled circle.
define syn_gfx_clear¶
Clear framebuffer.
define syn_gfx_fill¶
Fill with solid color.
define syn_gfx_flush¶
Flush the entire framebuffer to the display.
define syn_gfx_flush_partial¶
Flush a partial region of the framebuffer.
#define syn_gfx_flush_partial (
ctx,
offset,
len
) `syn_canvas_flush_partial ((ctx), (offset), (len))`
define syn_gfx_font_width¶
Return the glyph width of the active font (pixels).
define syn_gfx_hline¶
Horizontal line.
define syn_gfx_line¶
#define syn_gfx_line (
ctx,
x0,
y0,
x1,
y1,
color
) `syn_canvas_line ((ctx), (x0), (y0), (x1), (y1), (color))`
Draw line.
define syn_gfx_pixel¶
Draw pixel.
define syn_gfx_rect¶
#define syn_gfx_rect (
ctx,
x,
y,
w,
h,
color
) `syn_canvas_rect ((ctx), (x), (y), (w), (h), (color))`
Draw rect outline.
define syn_gfx_rect_fill¶
#define syn_gfx_rect_fill (
ctx,
x,
y,
w,
h,
color
) `syn_canvas_rect_fill ((ctx), (x), (y), (w), (h), (color))`
Draw filled rect.
define syn_gfx_rect_round¶
#define syn_gfx_rect_round (
ctx,
x,
y,
w,
h,
r,
color
) `syn_canvas_rect_round ((ctx), (x), (y), (w), (h), (r), (color))`
Draw rounded rect.
define syn_gfx_rect_round_fill¶
Draw filled rounded rect.
define syn_gfx_reset_clip¶
Reset clip to full canvas.
define syn_gfx_set_clip¶
Set clip rectangle.
define syn_gfx_text¶
Draw text string.
define syn_gfx_text_height¶
Get text line height.
define syn_gfx_text_width¶
Measure text width. \
define syn_gfx_vline¶
Vertical line.
The documentation for this class was generated from the following file src/syntropic/display/syn_gfx.h