aboutsummaryrefslogtreecommitdiff
path: root/draw.h
diff options
context:
space:
mode:
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 */