From ae59c294bfd4b73f6e751a3103c2ee7501068492 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Fri, 20 Sep 2024 23:57:19 +0200 Subject: Start parsing effects --- src/effect.h | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/effect.h') diff --git a/src/effect.h b/src/effect.h index 1bf1a9e..980d339 100644 --- a/src/effect.h +++ b/src/effect.h @@ -5,25 +5,41 @@ #include "util.h" -typedef enum { - EFFECT_PULSE, -} effect_type_t; - typedef struct effect effect_t; +typedef struct effect_info effect_info_t; + typedef struct layout layout_t; +// NOTE: Should only allocate the effect and set any extra values +// +typedef effect_t *(*effect_allocate_t)(const effect_info_t *info); + +// NOTE: Must free any state associated with the effect +// +typedef void (*effect_finalize_t)(effect_t *effect); + typedef void (*effect_render_t)(effect_t *effect, layout_t *layout, cairo_t *cr); -struct effect { - effect_type_t type; - struct timespec start; +// NOTE: effect_info's state will be free'd simply +// +struct effect_info { + char *label; struct timespec duration; + effect_allocate_t allocate; + effect_finalize_t finalize; effect_render_t pre; effect_render_t post; + void *state; +}; + +struct effect { + effect_info_t *info; + struct timespec start; + struct effect *next; }; -effect_t *effect_pulse(struct timespec duration); +void effect_info_free(effect_info_t *info); void effect_free(effect_t *effect); -- cgit v1.2.3