summaryrefslogtreecommitdiff
path: root/src/modules/spokes/draw.h
diff options
context:
space:
mode:
authorPhilip J Freeman <elektron@halo.nu>2022-08-06 09:40:11 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-12-01 14:00:32 -0800
commitdc59f812eedc39c0e764a19519aeb88856992d12 (patch)
tree1770e4990c126011b0175556026d15ff3959cb8e /src/modules/spokes/draw.h
parenta8d8fecb9d97cc6e4c3ff82771e98243a037691b (diff)
modules/spokes: add spokes module
This module started out as a way to test a line drawing algorithm, but ended up looking interesting enough to include as a module of it's own. #ZephyrCommit #BirdwalkCommit
Diffstat (limited to 'src/modules/spokes/draw.h')
-rw-r--r--src/modules/spokes/draw.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/spokes/draw.h b/src/modules/spokes/draw.h
new file mode 100644
index 0000000..0b68c00
--- /dev/null
+++ b/src/modules/spokes/draw.h
@@ -0,0 +1,16 @@
+#ifndef _DRAW_H
+#define _DRAW_H
+
+#include <stdint.h>
+
+/* helper for scaling rgb colors and packing them into an pixel */
+static inline uint32_t makergb(uint32_t r, uint32_t g, uint32_t b, float intensity)
+{
+ r = (((float)intensity) * r);
+ g = (((float)intensity) * g);
+ b = (((float)intensity) * b);
+
+ return (((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff));
+}
+
+#endif
© All Rights Reserved