1 #ifndef _SWAYLOCK_EFFECTS_H
2 #define _SWAYLOCK_EFFECTS_H
3 
4 #include <stdbool.h>
5 
6 #include "cairo.h"
7 
8 struct swaylock_effect_screen_pos {
9 	float pos;
10 	bool is_percent;
11 };
12 
13 struct swaylock_effect {
14 	union {
15 		struct {
16 			int radius, times;
17 		} blur;
18 		struct {
19 			int factor;
20 		} pixelate;
21 		double scale;
22 		struct {
23 			double base;
24 			double factor;
25 		} vignette;
26 		struct {
27 			struct swaylock_effect_screen_pos x;
28 			struct swaylock_effect_screen_pos y;
29 			struct swaylock_effect_screen_pos w;
30 			struct swaylock_effect_screen_pos h;
31 			enum {
32 				EFFECT_COMPOSE_GRAV_CENTER,
33 				EFFECT_COMPOSE_GRAV_NW,
34 				EFFECT_COMPOSE_GRAV_NE,
35 				EFFECT_COMPOSE_GRAV_SW,
36 				EFFECT_COMPOSE_GRAV_SE,
37 				EFFECT_COMPOSE_GRAV_N,
38 				EFFECT_COMPOSE_GRAV_S,
39 				EFFECT_COMPOSE_GRAV_E,
40 				EFFECT_COMPOSE_GRAV_W,
41 			} gravity;
42 			char *imgpath;
43 		} compose;
44 		char *custom;
45 	} e;
46 
47 	enum {
48 		EFFECT_BLUR,
49 		EFFECT_PIXELATE,
50 		EFFECT_SCALE,
51 		EFFECT_GREYSCALE,
52 		EFFECT_VIGNETTE,
53 		EFFECT_COMPOSE,
54 		EFFECT_CUSTOM,
55 	} tag;
56 };
57 
58 cairo_surface_t *swaylock_effects_run(cairo_surface_t *surface, int scale,
59 		struct swaylock_effect *effects, int count);
60 
61 cairo_surface_t *swaylock_effects_run_timed(cairo_surface_t *surface, int scale,
62 		struct swaylock_effect *effects, int count);
63 
64 #endif
65