diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-10-20 11:44:30 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-10-20 11:44:30 +0200 |
| commit | 9b9005101e6170a226acb265428aac429be6edbf (patch) | |
| tree | f89c76f4a5c2a00a72abe9b92468ac9f15083b94 /draw.h | |
| download | facedet-9b9005101e6170a226acb265428aac429be6edbf.tar.gz facedet-9b9005101e6170a226acb265428aac429be6edbf.zip | |
Init
Diffstat (limited to 'draw.h')
| -rw-r--r-- | draw.h | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -0,0 +1,30 @@ +#ifndef VIX_DRAW_H +#define VIX_DRAW_H + +/* Minimal raster primitives over a packed RGB24 buffer, enough for the + * debug overlay: rectangles, filled bars, landmark dots + * and text. Every coordinate is in pixels and every primitive clips to the + * canvas, so callers may pass boxes that fall partly outside the frame. */ + +typedef struct { + unsigned char *px; /* w*h*3 bytes, RGB order */ + int w, h; +} vix_canvas; + +typedef struct { + unsigned char r, g, b; +} vix_rgb; + +void vix_draw_rect(const vix_canvas *c, int x, int y, int w, int h, vix_rgb col, int thickness); +void vix_draw_fill(const vix_canvas *c, int x, int y, int w, int h, vix_rgb col); +void vix_draw_dot(const vix_canvas *c, int cx, int cy, int r, vix_rgb col); + +/* Draws s with its top-left corner at (x, y). Glyphs are 5x7 with a one + * pixel gap, so one character advances 6*scale pixels and the text is + * 7*scale pixels tall. Returns the width the string occupied. */ +int vix_draw_text(const vix_canvas *c, int x, int y, const char *s, vix_rgb col, int scale); + +/* Width vix_draw_text would occupy, for right-aligning or centring. */ +int vix_text_width(const char *s, int scale); + +#endif |
