all repos — tint2 @ 8917a4d15b15a06915bf6a4a52d90271675568a9

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

src/util/gradient.h (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef GRADIENT_H
#define GRADIENT_H

#include <glib.h>
#include <cairo.h>

#include "color.h"

//////////////////////////////////////////////////////////////////////
// Gradient types read from config options, not associated to any area

typedef enum GradientType {
	GRADIENT_VERTICAL = 0,
	GRADIENT_HORIZONTAL,
	GRADIENT_CENTERED
} GradientType;

typedef struct ColorStop {
	Color color;
	// offset in 0-1
	double offset;
} ColorStop;

typedef enum Element {
	ELEMENT_SELF = 0,
	ELEMENT_PARENT,
	ELEMENT_PANEL
} Element;

typedef enum SizeVariable {
	SIZE_WIDTH = 0,
	SIZE_HEIGHT,
	SIZE_RADIUS,
	SIZE_LEFT,
	SIZE_RIGHT,
	SIZE_TOP,
	SIZE_BOTTOM,
	SIZE_CENTERX,
	SIZE_CENTERY
} SizeVariable;

typedef struct Offset {
	gboolean constant;
	// if constant == true
	double constant_value;
	// else
	Element element;
	SizeVariable variable;
	double multiplier;
} Offset;

typedef struct ControlPoint {
	// Each element is an Offset
	GList *offsets_x;
	GList *offsets_y;
	// Defined only for radial gradients
	GList *offsets_r;
} ControlPoint;

typedef struct GradientClass {
	GradientType type;
	Color start_color;
	Color end_color;
	// Each element is a ColorStop
	GList *extra_color_stops;
	ControlPoint from;
	ControlPoint to;
} GradientClass;

GradientType gradient_type_from_string(const char *str);
void init_gradient(GradientClass *g, GradientType type);
void cleanup_gradient(GradientClass *g);

/////////////////////////////////////////
// Gradient instances associated to Areas

struct Area;
typedef struct Area Area;

typedef struct GradientInstance {
	GradientClass *gradient_class;
	Area *area;
	cairo_pattern_t *pattern;
} GradientInstance;

extern gboolean debug_gradients;

#endif // GRADIENT_H