aboutsummaryrefslogtreecommitdiff
path: root/draw.h
diff options
context:
space:
mode:
authorLena <lena@omega>2026-01-01 00:00:00 +0000
committerLena <lena@omega>2026-01-01 00:00:00 +0000
commit2fa72ee0dc67d973330aec4ba98260e9f57f7821 (patch)
treee6a25c07c8da61d29e4e1f8a72436565e63c5777 /draw.h
downloadmouseboard-0.1.tar.gz
Enter mouseboardHEADv0.1master
Keyboard-only pointing: a labelled grid over every monitor, type a label to jump to a cell, bisect it by quadrant until the crosshair is exact, then one key clicks. The coarse grid keeps labels short and bisection keeps precision unlimited, so a hotkey and a few keystrokes replace the mouse. The core talks only to the backend interface in platform.h; wlroots Wayland and Win32 backends supply the overlay, keyboard grab and pointer.
Diffstat (limited to 'draw.h')
-rw-r--r--draw.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/draw.h b/draw.h
new file mode 100644
index 0000000..945c0f7
--- /dev/null
+++ b/draw.h
@@ -0,0 +1,28 @@
+/*
+ * draw.h - software rendering onto an ARGB8888 mb_buffer.
+ *
+ * Colours are straight-alpha 0xAARRGGBB; they are premultiplied on the way in
+ * and overwrite the destination (the compositor blends the finished overlay
+ * over the desktop). All primitives clip to the buffer.
+ */
+#ifndef MOUSEBOARD_DRAW_H
+#define MOUSEBOARD_DRAW_H
+
+#include "platform.h"
+
+void draw_fill(struct mb_buffer *b, int x, int y, int w, int h, uint32_t argb);
+void draw_rect(struct mb_buffer *b, int x, int y, int w, int h, int thick,
+ uint32_t argb);
+void draw_hline(struct mb_buffer *b, int x, int y, int len, int thick,
+ uint32_t argb);
+void draw_vline(struct mb_buffer *b, int x, int y, int len, int thick,
+ uint32_t argb);
+
+/* Render text at scale (integer multiple of the 8x8 cell). Returns the pixel
+ * width drawn. */
+int draw_text(struct mb_buffer *b, int x, int y, const char *s, int scale,
+ uint32_t fg);
+int text_width(const char *s, int scale);
+int text_height(int scale);
+
+#endif /* MOUSEBOARD_DRAW_H */