diff options
| author | Federico Angelilli <code@fedang.net> | 2024-11-20 01:08:30 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-11-20 01:08:30 +0100 |
| commit | 30f91d7c8769a68e4bf11ed4ff0177bcf1bc9f03 (patch) | |
| tree | e666b46de81733bead5752c299b32b6c76b1dee0 /src/util.h | |
| parent | b5cb61379978fa6dc8d6468dd2f8b412e58cf7bb (diff) | |
Add gradients
Diffstat (limited to 'src/util.h')
| -rw-r--r-- | src/util.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -6,6 +6,7 @@ #include <stdbool.h> #include <stdio.h> #include <stdint.h> +#include <cairo.h> #define unreachable() log_panic("The impossible happened"); @@ -15,6 +16,12 @@ typedef struct { double r, g, b, a; } color_t; +typedef struct { + color_t *colors; + size_t length; + cairo_pattern_t *cached; +} gradient_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 }; @@ -35,6 +42,10 @@ char *color_to_string(color_t *color); void color_print(FILE *stream, color_t *color); +char *gradient_to_string(gradient_t *gradient); + +void gradient_free(gradient_t *gradient); + const struct timespec timespec_from_ms(long ms); const long timespec_to_ms(struct timespec ts); |
