1 /* GSK - The GTK Scene Kit
2  * Copyright 2016  Endless
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __GSK_ENUMS_H__
19 #define __GSK_ENUMS_H__
20 
21 #if !defined (__GSK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gsk/gsk.h> can be included directly."
23 #endif
24 
25 /**
26  * GskRenderNodeType:
27  * @GSK_NOT_A_RENDER_NODE: Error type. No node will ever have this type.
28  * @GSK_CONTAINER_NODE: A node containing a stack of children
29  * @GSK_CAIRO_NODE: A node drawing a `cairo_surface_t`
30  * @GSK_COLOR_NODE: A node drawing a single color rectangle
31  * @GSK_LINEAR_GRADIENT_NODE: A node drawing a linear gradient
32  * @GSK_REPEATING_LINEAR_GRADIENT_NODE: A node drawing a repeating linear gradient
33  * @GSK_RADIAL_GRADIENT_NODE: A node drawing a radial gradient
34  * @GSK_REPEATING_RADIAL_GRADIENT_NODE: A node drawing a repeating radial gradient
35  * @GSK_CONIC_GRADIENT_NODE: A node drawing a conic gradient
36  * @GSK_BORDER_NODE: A node stroking a border around an area
37  * @GSK_TEXTURE_NODE: A node drawing a `GdkTexture`
38  * @GSK_INSET_SHADOW_NODE: A node drawing an inset shadow
39  * @GSK_OUTSET_SHADOW_NODE: A node drawing an outset shadow
40  * @GSK_TRANSFORM_NODE: A node that renders its child after applying a matrix transform
41  * @GSK_OPACITY_NODE: A node that changes the opacity of its child
42  * @GSK_COLOR_MATRIX_NODE: A node that applies a color matrix to every pixel
43  * @GSK_REPEAT_NODE: A node that repeats the child's contents
44  * @GSK_CLIP_NODE: A node that clips its child to a rectangular area
45  * @GSK_ROUNDED_CLIP_NODE: A node that clips its child to a rounded rectangle
46  * @GSK_SHADOW_NODE: A node that draws a shadow below its child
47  * @GSK_BLEND_NODE: A node that blends two children together
48  * @GSK_CROSS_FADE_NODE: A node that cross-fades between two children
49  * @GSK_TEXT_NODE: A node containing a glyph string
50  * @GSK_BLUR_NODE: A node that applies a blur
51  * @GSK_DEBUG_NODE: Debug information that does not affect the rendering
52  * @GSK_GL_SHADER_NODE: A node that uses OpenGL fragment shaders to render
53 
54  * The type of a node determines what the node is rendering.
55  */
56 typedef enum {
57   GSK_NOT_A_RENDER_NODE = 0,
58   GSK_CONTAINER_NODE,
59   GSK_CAIRO_NODE,
60   GSK_COLOR_NODE,
61   GSK_LINEAR_GRADIENT_NODE,
62   GSK_REPEATING_LINEAR_GRADIENT_NODE,
63   GSK_RADIAL_GRADIENT_NODE,
64   GSK_REPEATING_RADIAL_GRADIENT_NODE,
65   GSK_CONIC_GRADIENT_NODE,
66   GSK_BORDER_NODE,
67   GSK_TEXTURE_NODE,
68   GSK_INSET_SHADOW_NODE,
69   GSK_OUTSET_SHADOW_NODE,
70   GSK_TRANSFORM_NODE,
71   GSK_OPACITY_NODE,
72   GSK_COLOR_MATRIX_NODE,
73   GSK_REPEAT_NODE,
74   GSK_CLIP_NODE,
75   GSK_ROUNDED_CLIP_NODE,
76   GSK_SHADOW_NODE,
77   GSK_BLEND_NODE,
78   GSK_CROSS_FADE_NODE,
79   GSK_TEXT_NODE,
80   GSK_BLUR_NODE,
81   GSK_DEBUG_NODE,
82   GSK_GL_SHADER_NODE
83 } GskRenderNodeType;
84 
85 /**
86  * GskScalingFilter:
87  * @GSK_SCALING_FILTER_LINEAR: linear interpolation filter
88  * @GSK_SCALING_FILTER_NEAREST: nearest neighbor interpolation filter
89  * @GSK_SCALING_FILTER_TRILINEAR: linear interpolation along each axis,
90  *   plus mipmap generation, with linear interpolation along the mipmap
91  *   levels
92  *
93  * The filters used when scaling texture data.
94  *
95  * The actual implementation of each filter is deferred to the
96  * rendering pipeline.
97  */
98 typedef enum {
99   GSK_SCALING_FILTER_LINEAR,
100   GSK_SCALING_FILTER_NEAREST,
101   GSK_SCALING_FILTER_TRILINEAR
102 } GskScalingFilter;
103 
104 /**
105  * GskBlendMode:
106  * @GSK_BLEND_MODE_DEFAULT: The default blend mode, which specifies no blending
107  * @GSK_BLEND_MODE_MULTIPLY: The source color is multiplied by the destination
108  *   and replaces the destination
109  * @GSK_BLEND_MODE_SCREEN: Multiplies the complements of the destination and source
110  *   color values, then complements the result.
111  * @GSK_BLEND_MODE_OVERLAY: Multiplies or screens the colors, depending on the
112  *   destination color value. This is the inverse of hard-list
113  * @GSK_BLEND_MODE_DARKEN: Selects the darker of the destination and source colors
114  * @GSK_BLEND_MODE_LIGHTEN: Selects the lighter of the destination and source colors
115  * @GSK_BLEND_MODE_COLOR_DODGE: Brightens the destination color to reflect the source color
116  * @GSK_BLEND_MODE_COLOR_BURN: Darkens the destination color to reflect the source color
117  * @GSK_BLEND_MODE_HARD_LIGHT: Multiplies or screens the colors, depending on the source color value
118  * @GSK_BLEND_MODE_SOFT_LIGHT: Darkens or lightens the colors, depending on the source color value
119  * @GSK_BLEND_MODE_DIFFERENCE: Subtracts the darker of the two constituent colors from the lighter color
120  * @GSK_BLEND_MODE_EXCLUSION: Produces an effect similar to that of the difference mode but lower in contrast
121  * @GSK_BLEND_MODE_COLOR: Creates a color with the hue and saturation of the source color and the luminosity of the destination color
122  * @GSK_BLEND_MODE_HUE: Creates a color with the hue of the source color and the saturation and luminosity of the destination color
123  * @GSK_BLEND_MODE_SATURATION: Creates a color with the saturation of the source color and the hue and luminosity of the destination color
124  * @GSK_BLEND_MODE_LUMINOSITY: Creates a color with the luminosity of the source color and the hue and saturation of the destination color
125  *
126  * The blend modes available for render nodes.
127  *
128  * The implementation of each blend mode is deferred to the
129  * rendering pipeline.
130  *
131  * See <https://www.w3.org/TR/compositing-1/#blending> for more information
132  * on blending and blend modes.
133  */
134 typedef enum {
135   GSK_BLEND_MODE_DEFAULT = 0,
136 
137   GSK_BLEND_MODE_MULTIPLY,
138   GSK_BLEND_MODE_SCREEN,
139   GSK_BLEND_MODE_OVERLAY,
140   GSK_BLEND_MODE_DARKEN,
141   GSK_BLEND_MODE_LIGHTEN,
142   GSK_BLEND_MODE_COLOR_DODGE,
143   GSK_BLEND_MODE_COLOR_BURN,
144   GSK_BLEND_MODE_HARD_LIGHT,
145   GSK_BLEND_MODE_SOFT_LIGHT,
146   GSK_BLEND_MODE_DIFFERENCE,
147   GSK_BLEND_MODE_EXCLUSION,
148   GSK_BLEND_MODE_COLOR,
149   GSK_BLEND_MODE_HUE,
150   GSK_BLEND_MODE_SATURATION,
151   GSK_BLEND_MODE_LUMINOSITY
152 } GskBlendMode;
153 
154 /**
155  * GskCorner:
156  * @GSK_CORNER_TOP_LEFT: The top left corner
157  * @GSK_CORNER_TOP_RIGHT: The top right corner
158  * @GSK_CORNER_BOTTOM_RIGHT: The bottom right corner
159  * @GSK_CORNER_BOTTOM_LEFT: The bottom left corner
160  *
161  * The corner indices used by `GskRoundedRect`.
162  */
163 typedef enum {
164   GSK_CORNER_TOP_LEFT,
165   GSK_CORNER_TOP_RIGHT,
166   GSK_CORNER_BOTTOM_RIGHT,
167   GSK_CORNER_BOTTOM_LEFT
168 } GskCorner;
169 
170 /**
171  * GskSerializationError:
172  * @GSK_SERIALIZATION_UNSUPPORTED_FORMAT: The format can not be identified
173  * @GSK_SERIALIZATION_UNSUPPORTED_VERSION: The version of the data is not
174  *   understood
175  * @GSK_SERIALIZATION_INVALID_DATA: The given data may not exist in
176  *   a proper serialization
177  *
178  * Errors that can happen during (de)serialization.
179  */
180 typedef enum {
181   GSK_SERIALIZATION_UNSUPPORTED_FORMAT,
182   GSK_SERIALIZATION_UNSUPPORTED_VERSION,
183   GSK_SERIALIZATION_INVALID_DATA
184 } GskSerializationError;
185 
186 /**
187  * GskTransformCategory:
188  * @GSK_TRANSFORM_CATEGORY_UNKNOWN: The category of the matrix has not been
189  *   determined.
190  * @GSK_TRANSFORM_CATEGORY_ANY: Analyzing the matrix concluded that it does
191  *   not fit in any other category.
192  * @GSK_TRANSFORM_CATEGORY_3D: The matrix is a 3D matrix. This means that
193  *   the w column (the last column) has the values (0, 0, 0, 1).
194  * @GSK_TRANSFORM_CATEGORY_2D: The matrix is a 2D matrix. This is equivalent
195  *   to graphene_matrix_is_2d() returning %TRUE. In particular, this
196  *   means that Cairo can deal with the matrix.
197  * @GSK_TRANSFORM_CATEGORY_2D_AFFINE: The matrix is a combination of 2D scale
198  *   and 2D translation operations. In particular, this means that any
199  *   rectangle can be transformed exactly using this matrix.
200  * @GSK_TRANSFORM_CATEGORY_2D_TRANSLATE: The matrix is a 2D translation.
201  * @GSK_TRANSFORM_CATEGORY_IDENTITY: The matrix is the identity matrix.
202  *
203  * The categories of matrices relevant for GSK and GTK.
204  *
205  * Note that any category includes matrices of all later categories.
206  * So if you want to for example check if a matrix is a 2D matrix,
207  * `category >= GSK_TRANSFORM_CATEGORY_2D` is the way to do this.
208  *
209  * Also keep in mind that rounding errors may cause matrices to not
210  * conform to their categories. Otherwise, matrix operations done via
211  * multiplication will not worsen categories. So for the matrix
212  * multiplication `C = A * B`, `category(C) = MIN (category(A), category(B))`.
213  */
214 typedef enum
215 {
216   GSK_TRANSFORM_CATEGORY_UNKNOWN,
217   GSK_TRANSFORM_CATEGORY_ANY,
218   GSK_TRANSFORM_CATEGORY_3D,
219   GSK_TRANSFORM_CATEGORY_2D,
220   GSK_TRANSFORM_CATEGORY_2D_AFFINE,
221   GSK_TRANSFORM_CATEGORY_2D_TRANSLATE,
222   GSK_TRANSFORM_CATEGORY_IDENTITY
223 } GskTransformCategory;
224 
225 /**
226  * GskGLUniformType:
227  * @GSK_GL_UNIFORM_TYPE_NONE: No type, used for uninitialized or unspecified values.
228  * @GSK_GL_UNIFORM_TYPE_FLOAT: A float uniform
229  * @GSK_GL_UNIFORM_TYPE_INT: A GLSL int / gint32 uniform
230  * @GSK_GL_UNIFORM_TYPE_UINT: A GLSL uint / guint32 uniform
231  * @GSK_GL_UNIFORM_TYPE_BOOL: A GLSL bool / gboolean uniform
232  * @GSK_GL_UNIFORM_TYPE_VEC2: A GLSL vec2 / graphene_vec2_t uniform
233  * @GSK_GL_UNIFORM_TYPE_VEC3: A GLSL vec3 / graphene_vec3_t uniform
234  * @GSK_GL_UNIFORM_TYPE_VEC4: A GLSL vec4 / graphene_vec4_t uniform
235  *
236  * This defines the types of the uniforms that `GskGLShaders`
237  * declare.
238  *
239  * It defines both what the type is called in the GLSL shader
240  * code, and what the corresponding C type is on the Gtk side.
241  */
242 typedef enum
243 {
244   GSK_GL_UNIFORM_TYPE_NONE,
245   GSK_GL_UNIFORM_TYPE_FLOAT,
246   GSK_GL_UNIFORM_TYPE_INT,
247   GSK_GL_UNIFORM_TYPE_UINT,
248   GSK_GL_UNIFORM_TYPE_BOOL,
249   GSK_GL_UNIFORM_TYPE_VEC2,
250   GSK_GL_UNIFORM_TYPE_VEC3,
251   GSK_GL_UNIFORM_TYPE_VEC4,
252 } GskGLUniformType;
253 
254 
255 #endif /* __GSK_TYPES_H__ */
256