aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-11-20 01:08:30 +0100
committerFederico Angelilli <code@fedang.net>2024-11-20 01:08:30 +0100
commit30f91d7c8769a68e4bf11ed4ff0177bcf1bc9f03 (patch)
treee666b46de81733bead5752c299b32b6c76b1dee0 /src/util.h
parentb5cb61379978fa6dc8d6468dd2f8b412e58cf7bb (diff)
Add gradients
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 8d60eb2..78dcad7 100644
--- a/src/util.h
+++ b/src/util.h
@@ -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);