aboutsummaryrefslogtreecommitdiff
path: root/src/effect.h
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-09-20 23:57:19 +0200
committerFederico Angelilli <code@fedang.net>2024-09-20 23:57:19 +0200
commitae59c294bfd4b73f6e751a3103c2ee7501068492 (patch)
treeefbcded195dfd24f9534f69f47f728ecca34b762 /src/effect.h
parentbc70dead7fb518f073fecb21a04fa374e9ad6dd0 (diff)
Start parsing effects
Diffstat (limited to 'src/effect.h')
-rw-r--r--src/effect.h32
1 files changed, 24 insertions, 8 deletions
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);