diff options
author | Philip J Freeman <elektron@halo.nu> | 2020-01-01 15:04:34 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-01-06 11:45:03 -0800 |
commit | 3a17d7380b5f024992b032dcdcad2c2aa16df99e (patch) | |
tree | a147783354fb36f8864a8d23fa6dde703ee0362c /src/modules/spiro/draw.h | |
parent | 3ae1e53ac08887a0e8209499aee4daade9c5ea8e (diff) |
spiro: spirograph emulator
This commit adds a module that emulates a spirograph
Diffstat (limited to 'src/modules/spiro/draw.h')
-rw-r--r-- | src/modules/spiro/draw.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/spiro/draw.h b/src/modules/spiro/draw.h new file mode 100644 index 0000000..0b68c00 --- /dev/null +++ b/src/modules/spiro/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 |