diff options
| author | Federico Angelilli <code@fedang.net> | 2024-07-11 13:08:26 +0200 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-07-11 13:08:26 +0200 |
| commit | 226c6b5bf79912b657c7cb4c5a679891030fa453 (patch) | |
| tree | a465033a13d4d14cb886334f154f8f7af81a3b3e /src/util.h | |
| parent | 39e0f4e90dccbfb38db14a0cd4f596c1b5006b19 (diff) | |
Start working on block config
Diffstat (limited to 'src/util.h')
| -rw-r--r-- | src/util.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -5,6 +5,23 @@ #include <stddef.h> #include <stdbool.h> +// Color representation normalized to [0, 1] +// +typedef struct { + double r, g, b, a; +} color_t; + +static inline color_t color_rgba(int r, int g, int b, int a) +{ + color_t color = { r / 255.0, g / 255.0, b / 255.0, a / 255.0 }; + return color; +} + +static inline color_t color_rgb(int r, int g, int b) +{ + return color_rgba(r, g, b, 255); +} + struct timespec timespec_diff(struct timespec a, struct timespec b); bool timespec_greater(struct timespec a, struct timespec b); |
