aboutsummaryrefslogtreecommitdiff
path: root/draw.h
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-10-20 11:44:30 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-10-20 11:44:30 +0200
commit9b9005101e6170a226acb265428aac429be6edbf (patch)
treef89c76f4a5c2a00a72abe9b92468ac9f15083b94 /draw.h
downloadfacedet-9b9005101e6170a226acb265428aac429be6edbf.tar.gz
facedet-9b9005101e6170a226acb265428aac429be6edbf.zip
Init
Diffstat (limited to 'draw.h')
-rw-r--r--draw.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/draw.h b/draw.h
new file mode 100644
index 0000000..8f8b985
--- /dev/null
+++ b/draw.h
@@ -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