From dc59f812eedc39c0e764a19519aeb88856992d12 Mon Sep 17 00:00:00 2001 From: Philip J Freeman Date: Sat, 6 Aug 2022 09:40:11 -0700 Subject: 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 --- src/modules/spokes/draw.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/modules/spokes/draw.h (limited to 'src/modules/spokes/draw.h') 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 + +/* 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 -- cgit v1.2.3