gskrendernode.h 31 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* GSK - The GTK Scene Kit
 *
 * Copyright 2016  Endless
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __GSK_RENDER_NODE_H__
#define __GSK_RENDER_NODE_H__

22
#if !defined (__GSK_H_INSIDE__) && !defined (GTK_COMPILATION)
23
24
25
#error "Only <gsk/gsk.h> can be included directly."
#endif

26
#include <gsk/gskroundedrect.h>
27
#include <gsk/gsktypes.h>
28
#include <gsk/gskglshader.h>
29
#include <gtk/css/gtkcss.h>
30
31
32
33
34

G_BEGIN_DECLS

#define GSK_TYPE_RENDER_NODE (gsk_render_node_get_type ())

35
#define GSK_IS_RENDER_NODE(obj) ((obj) != NULL)
36

37
38
#define GSK_SERIALIZATION_ERROR       (gsk_serialization_error_quark ())

39
typedef struct _GskRenderNode           GskRenderNode;
40
typedef struct _GskColorStop            GskColorStop;
Benjamin Otte's avatar
Benjamin Otte committed
41
typedef struct _GskShadow               GskShadow;
42

43
44
45
46
47
48
49
/**
 * GskColorStop:
 * @offset: the offset of the color stop
 * @color: the color at the given offset
 *
 * A color stop in a gradient node.
 */
50
51
struct _GskColorStop
{
52
  float offset;
53
54
  GdkRGBA color;
};
55

56
57
58
59
60
61
62
63
64
/**
 * GskShadow:
 * @color: the color of the shadow
 * @dx: the horizontal offset of the shadow
 * @dy: the vertical offset of the shadow
 * @radius: the radius of the shadow
 *
 * The shadow parameters in a shadow node.
 */
Benjamin Otte's avatar
Benjamin Otte committed
65
66
67
68
69
70
71
72
struct _GskShadow
{
  GdkRGBA color;
  float dx;
  float dy;
  float radius;
};

73
74
typedef struct _GskParseLocation GskParseLocation;

75
76
77
78
79
80
81
82
83
84
/**
 * GskParseLocation:
 * @bytes: the offset of the location in the parse buffer, as bytes
 * @chars: the offset of the location in the parse buffer, as characters
 * @lines: the line of the location in the parse buffer
 * @line_bytes: the position in the line, as bytes
 * @line_chars: the position in the line, as characters
 *
 * A location in a parse buffer.
 */
85
86
87
88
89
90
91
92
93
struct _GskParseLocation
{
  gsize bytes;
  gsize chars;
  gsize lines;
  gsize line_bytes;
  gsize line_chars;
};

94
95
/**
 * GskParseErrorFunc:
96
97
98
 * @start: start of the error location
 * @end: end of the error location
 * @error: the error
99
100
 * @user_data: user data
 *
Matthias Clasen's avatar
Matthias Clasen committed
101
102
 * Type of callback that is called when an error occurs
 * during node deserialization.
103
 */
104
105
106
107
typedef void           (* GskParseErrorFunc)                    (const GskParseLocation *start,
                                                                 const GskParseLocation *end,
                                                                 const GError           *error,
                                                                 gpointer                user_data);
108

Matthias Clasen's avatar
Matthias Clasen committed
109
GDK_AVAILABLE_IN_ALL
110
111
GType                   gsk_render_node_get_type                (void) G_GNUC_CONST;

Matthias Clasen's avatar
Matthias Clasen committed
112
GDK_AVAILABLE_IN_ALL
113
GQuark                  gsk_serialization_error_quark           (void);
114

Matthias Clasen's avatar
Matthias Clasen committed
115
GDK_AVAILABLE_IN_ALL
116
GskRenderNode *         gsk_render_node_ref                     (GskRenderNode *node);
Matthias Clasen's avatar
Matthias Clasen committed
117
GDK_AVAILABLE_IN_ALL
118
void                    gsk_render_node_unref                   (GskRenderNode *node);
119

Matthias Clasen's avatar
Matthias Clasen committed
120
GDK_AVAILABLE_IN_ALL
121
GskRenderNodeType       gsk_render_node_get_node_type           (const GskRenderNode *node);
Benjamin Otte's avatar
Benjamin Otte committed
122

Matthias Clasen's avatar
Matthias Clasen committed
123
GDK_AVAILABLE_IN_ALL
124
125
126
void                    gsk_render_node_get_bounds              (GskRenderNode   *node,
                                                                 graphene_rect_t *bounds);

Matthias Clasen's avatar
Matthias Clasen committed
127
GDK_AVAILABLE_IN_ALL
128
129
130
void                    gsk_render_node_draw                    (GskRenderNode *node,
                                                                 cairo_t       *cr);

Matthias Clasen's avatar
Matthias Clasen committed
131
GDK_AVAILABLE_IN_ALL
132
GBytes *                gsk_render_node_serialize               (GskRenderNode *node);
Matthias Clasen's avatar
Matthias Clasen committed
133
GDK_AVAILABLE_IN_ALL
134
135
136
gboolean                gsk_render_node_write_to_file           (GskRenderNode *node,
                                                                 const char    *filename,
                                                                 GError       **error);
Matthias Clasen's avatar
Matthias Clasen committed
137
GDK_AVAILABLE_IN_ALL
138
139
140
GskRenderNode *         gsk_render_node_deserialize             (GBytes            *bytes,
                                                                 GskParseErrorFunc  error_func,
                                                                 gpointer           user_data);
141

142
143
144
145
146
#define GSK_TYPE_DEBUG_NODE                     (gsk_debug_node_get_type())
#define GSK_TYPE_COLOR_NODE                     (gsk_color_node_get_type())
#define GSK_TYPE_TEXTURE_NODE                   (gsk_texture_node_get_type())
#define GSK_TYPE_LINEAR_GRADIENT_NODE           (gsk_linear_gradient_node_get_type())
#define GSK_TYPE_REPEATING_LINEAR_GRADIENT_NODE (gsk_repeating_linear_gradient_node_get_type())
147
148
#define GSK_TYPE_RADIAL_GRADIENT_NODE           (gsk_radial_gradient_node_get_type())
#define GSK_TYPE_REPEATING_RADIAL_GRADIENT_NODE (gsk_repeating_radial_gradient_node_get_type())
Benjamin Otte's avatar
Benjamin Otte committed
149
#define GSK_TYPE_CONIC_GRADIENT_NODE            (gsk_conic_gradient_node_get_type())
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#define GSK_TYPE_BORDER_NODE                    (gsk_border_node_get_type())
#define GSK_TYPE_INSET_SHADOW_NODE              (gsk_inset_shadow_node_get_type())
#define GSK_TYPE_OUTSET_SHADOW_NODE             (gsk_outset_shadow_node_get_type())
#define GSK_TYPE_CAIRO_NODE                     (gsk_cairo_node_get_type())
#define GSK_TYPE_CONTAINER_NODE                 (gsk_container_node_get_type())
#define GSK_TYPE_TRANSFORM_NODE                 (gsk_transform_node_get_type())
#define GSK_TYPE_OPACITY_NODE                   (gsk_opacity_node_get_type())
#define GSK_TYPE_COLOR_MATRIX_NODE              (gsk_color_matrix_node_get_type())
#define GSK_TYPE_REPEAT_NODE                    (gsk_repeat_node_get_type())
#define GSK_TYPE_CLIP_NODE                      (gsk_clip_node_get_type())
#define GSK_TYPE_ROUNDED_CLIP_NODE              (gsk_rounded_clip_node_get_type())
#define GSK_TYPE_SHADOW_NODE                    (gsk_shadow_node_get_type())
#define GSK_TYPE_BLEND_NODE                     (gsk_blend_node_get_type())
#define GSK_TYPE_CROSS_FADE_NODE                (gsk_cross_fade_node_get_type())
#define GSK_TYPE_TEXT_NODE                      (gsk_text_node_get_type())
#define GSK_TYPE_BLUR_NODE                      (gsk_blur_node_get_type())
166
#define GSK_TYPE_GL_SHADER_NODE                 (gsk_gl_shader_node_get_type())
167
168
169
170
171
172

typedef struct _GskDebugNode                    GskDebugNode;
typedef struct _GskColorNode                    GskColorNode;
typedef struct _GskTextureNode                  GskTextureNode;
typedef struct _GskLinearGradientNode           GskLinearGradientNode;
typedef struct _GskRepeatingLinearGradientNode  GskRepeatingLinearGradientNode;
173
174
typedef struct _GskRadialGradientNode           GskRadialGradientNode;
typedef struct _GskRepeatingRadialGradientNode  GskRepeatingRadialGradientNode;
Benjamin Otte's avatar
Benjamin Otte committed
175
typedef struct _GskConicGradientNode            GskConicGradientNode;
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
typedef struct _GskBorderNode                   GskBorderNode;
typedef struct _GskInsetShadowNode              GskInsetShadowNode;
typedef struct _GskOutsetShadowNode             GskOutsetShadowNode;
typedef struct _GskCairoNode                    GskCairoNode;
typedef struct _GskContainerNode                GskContainerNode;
typedef struct _GskTransformNode                GskTransformNode;
typedef struct _GskOpacityNode                  GskOpacityNode;
typedef struct _GskColorMatrixNode              GskColorMatrixNode;
typedef struct _GskRepeatNode                   GskRepeatNode;
typedef struct _GskClipNode                     GskClipNode;
typedef struct _GskRoundedClipNode              GskRoundedClipNode;
typedef struct _GskShadowNode                   GskShadowNode;
typedef struct _GskBlendNode                    GskBlendNode;
typedef struct _GskCrossFadeNode                GskCrossFadeNode;
typedef struct _GskTextNode                     GskTextNode;
typedef struct _GskBlurNode                     GskBlurNode;
192
typedef struct _GskGLShaderNode                 GskGLShaderNode;
193

194
195
GDK_AVAILABLE_IN_ALL
GType                   gsk_debug_node_get_type                 (void) G_GNUC_CONST;
Benjamin Otte's avatar
Benjamin Otte committed
196
197
198
199
GDK_AVAILABLE_IN_ALL
GskRenderNode *         gsk_debug_node_new                      (GskRenderNode            *child,
                                                                 char                     *message);
GDK_AVAILABLE_IN_ALL
200
GskRenderNode *         gsk_debug_node_get_child                (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
201
GDK_AVAILABLE_IN_ALL
202
const char *            gsk_debug_node_get_message              (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
203

204
205
GDK_AVAILABLE_IN_ALL
GType                   gsk_color_node_get_type                 (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
206
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
207
208
GskRenderNode *         gsk_color_node_new                      (const GdkRGBA            *rgba,
                                                                 const graphene_rect_t    *bounds);
Matthias Clasen's avatar
Matthias Clasen committed
209
GDK_AVAILABLE_IN_ALL
210
const GdkRGBA *         gsk_color_node_get_color                (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
211

212
213
GDK_AVAILABLE_IN_ALL
GType                   gsk_texture_node_get_type               (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
214
GDK_AVAILABLE_IN_ALL
215
GskRenderNode *         gsk_texture_node_new                    (GdkTexture               *texture,
216
                                                                 const graphene_rect_t    *bounds);
Matthias Clasen's avatar
Matthias Clasen committed
217
GDK_AVAILABLE_IN_ALL
218
GdkTexture *            gsk_texture_node_get_texture            (const GskRenderNode      *node) G_GNUC_PURE;
219

220
221
GDK_AVAILABLE_IN_ALL
GType                   gsk_linear_gradient_node_get_type           (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
222
GDK_AVAILABLE_IN_ALL
223
224
225
226
227
GskRenderNode *         gsk_linear_gradient_node_new                (const graphene_rect_t    *bounds,
                                                                     const graphene_point_t   *start,
                                                                     const graphene_point_t   *end,
                                                                     const GskColorStop       *color_stops,
                                                                     gsize                     n_color_stops);
Matthias Clasen's avatar
Matthias Clasen committed
228
GDK_AVAILABLE_IN_ALL
229
const graphene_point_t * gsk_linear_gradient_node_get_start         (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
230
GDK_AVAILABLE_IN_ALL
231
const graphene_point_t * gsk_linear_gradient_node_get_end           (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
232
GDK_AVAILABLE_IN_ALL
233
gsize                    gsk_linear_gradient_node_get_n_color_stops (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
234
GDK_AVAILABLE_IN_ALL
235
const GskColorStop *     gsk_linear_gradient_node_get_color_stops   (const GskRenderNode      *node,
236
                                                                     gsize                    *n_stops) G_GNUC_PURE;
237

238
239
GDK_AVAILABLE_IN_ALL
GType                   gsk_repeating_linear_gradient_node_get_type (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
240
GDK_AVAILABLE_IN_ALL
241
242
243
244
245
GskRenderNode *         gsk_repeating_linear_gradient_node_new      (const graphene_rect_t    *bounds,
                                                                     const graphene_point_t   *start,
                                                                     const graphene_point_t   *end,
                                                                     const GskColorStop       *color_stops,
                                                                     gsize                     n_color_stops);
246

Benjamin Otte's avatar
Benjamin Otte committed
247
248
249
250
251
252
253
254
255
GDK_AVAILABLE_IN_ALL
GType                   gsk_conic_gradient_node_get_type            (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GskRenderNode *         gsk_conic_gradient_node_new                 (const graphene_rect_t    *bounds,
                                                                     const graphene_point_t   *center,
                                                                     float                     rotation,
                                                                     const GskColorStop       *color_stops,
                                                                     gsize                     n_color_stops);
GDK_AVAILABLE_IN_ALL
256
const graphene_point_t * gsk_conic_gradient_node_get_center         (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
257
GDK_AVAILABLE_IN_ALL
258
float                    gsk_conic_gradient_node_get_rotation       (const GskRenderNode      *node) G_GNUC_PURE;
259
GDK_AVAILABLE_IN_4_2
260
float                    gsk_conic_gradient_node_get_angle          (const GskRenderNode      *node) G_GNUC_PURE;
261
GDK_AVAILABLE_IN_ALL
262
gsize                    gsk_conic_gradient_node_get_n_color_stops  (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
263
GDK_AVAILABLE_IN_ALL
264
const GskColorStop *     gsk_conic_gradient_node_get_color_stops    (const GskRenderNode      *node,
265
                                                                     gsize                    *n_stops) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
266

267
268
269
270
271
GDK_AVAILABLE_IN_ALL
GType                   gsk_radial_gradient_node_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GskRenderNode *         gsk_radial_gradient_node_new      (const graphene_rect_t    *bounds,
                                                           const graphene_point_t   *center,
272
273
                                                           float                     hradius,
                                                           float                     vradius,
274
275
276
277
278
                                                           float                     start,
                                                           float                     end,
                                                           const GskColorStop       *color_stops,
                                                           gsize                     n_color_stops);
GDK_AVAILABLE_IN_ALL
279
gsize                   gsk_radial_gradient_node_get_n_color_stops (const GskRenderNode *node) G_GNUC_PURE;
280
GDK_AVAILABLE_IN_ALL
281
const GskColorStop *    gsk_radial_gradient_node_get_color_stops   (const GskRenderNode *node,
282
                                                                    gsize               *n_stops) G_GNUC_PURE;
283
GDK_AVAILABLE_IN_ALL
284
const graphene_point_t *gsk_radial_gradient_node_get_center        (const GskRenderNode *node) G_GNUC_PURE;
285
GDK_AVAILABLE_IN_ALL
286
float                   gsk_radial_gradient_node_get_hradius       (const GskRenderNode *node) G_GNUC_PURE;
287
GDK_AVAILABLE_IN_ALL
288
float                   gsk_radial_gradient_node_get_vradius       (const GskRenderNode *node) G_GNUC_PURE;
289
GDK_AVAILABLE_IN_ALL
290
float                   gsk_radial_gradient_node_get_start         (const GskRenderNode *node) G_GNUC_PURE;
291
GDK_AVAILABLE_IN_ALL
292
float                   gsk_radial_gradient_node_get_end           (const GskRenderNode *node) G_GNUC_PURE;
293
294
295
296
297
298

GDK_AVAILABLE_IN_ALL
GType                   gsk_repeating_radial_gradient_node_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GskRenderNode *         gsk_repeating_radial_gradient_node_new      (const graphene_rect_t    *bounds,
                                                                     const graphene_point_t   *center,
299
300
                                                                     float                     hradius,
                                                                     float                     vradius,
301
302
303
304
305
                                                                     float                     start,
                                                                     float                     end,
                                                                     const GskColorStop       *color_stops,
                                                                     gsize                     n_color_stops);

306
307
GDK_AVAILABLE_IN_ALL
GType                   gsk_border_node_get_type                (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
308
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
309
310
311
GskRenderNode *         gsk_border_node_new                     (const GskRoundedRect     *outline,
                                                                 const float               border_width[4],
                                                                 const GdkRGBA             border_color[4]);
Matthias Clasen's avatar
Matthias Clasen committed
312
GDK_AVAILABLE_IN_ALL
313
const GskRoundedRect *  gsk_border_node_get_outline             (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
314
GDK_AVAILABLE_IN_ALL
315
const float *           gsk_border_node_get_widths              (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
316
GDK_AVAILABLE_IN_ALL
317
const GdkRGBA *         gsk_border_node_get_colors              (const GskRenderNode      *node) G_GNUC_PURE;
318

319
320
GDK_AVAILABLE_IN_ALL
GType                   gsk_inset_shadow_node_get_type          (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
321
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
322
323
324
325
326
327
GskRenderNode *         gsk_inset_shadow_node_new               (const GskRoundedRect     *outline,
                                                                 const GdkRGBA            *color,
                                                                 float                     dx,
                                                                 float                     dy,
                                                                 float                     spread,
                                                                 float                     blur_radius);
Matthias Clasen's avatar
Matthias Clasen committed
328
GDK_AVAILABLE_IN_ALL
329
const GskRoundedRect *  gsk_inset_shadow_node_get_outline       (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
330
GDK_AVAILABLE_IN_ALL
331
const GdkRGBA *         gsk_inset_shadow_node_get_color         (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
332
GDK_AVAILABLE_IN_ALL
333
float                   gsk_inset_shadow_node_get_dx            (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
334
GDK_AVAILABLE_IN_ALL
335
float                   gsk_inset_shadow_node_get_dy            (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
336
GDK_AVAILABLE_IN_ALL
337
float                   gsk_inset_shadow_node_get_spread        (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
338
GDK_AVAILABLE_IN_ALL
339
float                   gsk_inset_shadow_node_get_blur_radius   (const GskRenderNode      *node) G_GNUC_PURE;
340

341
342
GDK_AVAILABLE_IN_ALL
GType                   gsk_outset_shadow_node_get_type         (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
343
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
344
345
346
347
348
349
GskRenderNode *         gsk_outset_shadow_node_new              (const GskRoundedRect     *outline,
                                                                 const GdkRGBA            *color,
                                                                 float                     dx,
                                                                 float                     dy,
                                                                 float                     spread,
                                                                 float                     blur_radius);
Matthias Clasen's avatar
Matthias Clasen committed
350
GDK_AVAILABLE_IN_ALL
351
const GskRoundedRect *  gsk_outset_shadow_node_get_outline      (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
352
GDK_AVAILABLE_IN_ALL
353
const GdkRGBA *         gsk_outset_shadow_node_get_color        (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
354
GDK_AVAILABLE_IN_ALL
355
float                   gsk_outset_shadow_node_get_dx           (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
356
GDK_AVAILABLE_IN_ALL
357
float                   gsk_outset_shadow_node_get_dy           (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
358
GDK_AVAILABLE_IN_ALL
359
float                   gsk_outset_shadow_node_get_spread       (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
360
GDK_AVAILABLE_IN_ALL
361
float                   gsk_outset_shadow_node_get_blur_radius  (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
362

363
364
GDK_AVAILABLE_IN_ALL
GType                   gsk_cairo_node_get_type                 (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
365
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
366
GskRenderNode *         gsk_cairo_node_new                      (const graphene_rect_t    *bounds);
Matthias Clasen's avatar
Matthias Clasen committed
367
GDK_AVAILABLE_IN_ALL
368
cairo_t *               gsk_cairo_node_get_draw_context         (GskRenderNode            *node);
Matthias Clasen's avatar
Matthias Clasen committed
369
GDK_AVAILABLE_IN_ALL
370
cairo_surface_t *       gsk_cairo_node_get_surface              (GskRenderNode            *node);
Benjamin Otte's avatar
Benjamin Otte committed
371

372
373
GDK_AVAILABLE_IN_ALL
GType                   gsk_container_node_get_type             (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
374
GDK_AVAILABLE_IN_ALL
375
376
GskRenderNode *         gsk_container_node_new                  (GskRenderNode           **children,
                                                                 guint                     n_children);
Matthias Clasen's avatar
Matthias Clasen committed
377
GDK_AVAILABLE_IN_ALL
378
guint                   gsk_container_node_get_n_children       (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
379
GDK_AVAILABLE_IN_ALL
380
GskRenderNode *         gsk_container_node_get_child            (const GskRenderNode      *node,
381
                                                                 guint                     idx) G_GNUC_PURE;
382

383
384
GDK_AVAILABLE_IN_ALL
GType                   gsk_transform_node_get_type             (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
385
GDK_AVAILABLE_IN_ALL
386
GskRenderNode *         gsk_transform_node_new                  (GskRenderNode            *child,
387
                                                                 GskTransform             *transform);
Matthias Clasen's avatar
Matthias Clasen committed
388
GDK_AVAILABLE_IN_ALL
389
GskRenderNode *         gsk_transform_node_get_child            (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
390
GDK_AVAILABLE_IN_ALL
391
GskTransform *          gsk_transform_node_get_transform        (const GskRenderNode      *node) G_GNUC_PURE;
392

393
394
GDK_AVAILABLE_IN_ALL
GType                   gsk_opacity_node_get_type               (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
395
GDK_AVAILABLE_IN_ALL
396
GskRenderNode *         gsk_opacity_node_new                    (GskRenderNode            *child,
397
                                                                 float                     opacity);
Matthias Clasen's avatar
Matthias Clasen committed
398
GDK_AVAILABLE_IN_ALL
399
GskRenderNode *         gsk_opacity_node_get_child              (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
400
GDK_AVAILABLE_IN_ALL
401
float                   gsk_opacity_node_get_opacity            (const GskRenderNode      *node) G_GNUC_PURE;
402

403
404
GDK_AVAILABLE_IN_ALL
GType                   gsk_color_matrix_node_get_type          (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
405
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
406
407
408
GskRenderNode *         gsk_color_matrix_node_new               (GskRenderNode            *child,
                                                                 const graphene_matrix_t  *color_matrix,
                                                                 const graphene_vec4_t    *color_offset);
Matthias Clasen's avatar
Matthias Clasen committed
409
GDK_AVAILABLE_IN_ALL
410
GskRenderNode *         gsk_color_matrix_node_get_child         (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
411
GDK_AVAILABLE_IN_ALL
412
const graphene_matrix_t *
413
                        gsk_color_matrix_node_get_color_matrix  (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
414
GDK_AVAILABLE_IN_ALL
415
const graphene_vec4_t * gsk_color_matrix_node_get_color_offset  (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
416

417
418
GDK_AVAILABLE_IN_ALL
GType                   gsk_repeat_node_get_type                (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
419
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
420
421
422
GskRenderNode *         gsk_repeat_node_new                     (const graphene_rect_t    *bounds,
                                                                 GskRenderNode            *child,
                                                                 const graphene_rect_t    *child_bounds);
Matthias Clasen's avatar
Matthias Clasen committed
423
GDK_AVAILABLE_IN_ALL
424
GskRenderNode *         gsk_repeat_node_get_child               (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
425
GDK_AVAILABLE_IN_ALL
426
const graphene_rect_t * gsk_repeat_node_get_child_bounds        (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
427

428
429
GDK_AVAILABLE_IN_ALL
GType                   gsk_clip_node_get_type                  (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
430
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
431
432
GskRenderNode *         gsk_clip_node_new                       (GskRenderNode            *child,
                                                                 const graphene_rect_t    *clip);
Matthias Clasen's avatar
Matthias Clasen committed
433
GDK_AVAILABLE_IN_ALL
434
GskRenderNode *         gsk_clip_node_get_child                 (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
435
GDK_AVAILABLE_IN_ALL
436
const graphene_rect_t * gsk_clip_node_get_clip                  (const GskRenderNode      *node) G_GNUC_PURE;
437

438
439
GDK_AVAILABLE_IN_ALL
GType                   gsk_rounded_clip_node_get_type          (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
440
GDK_AVAILABLE_IN_ALL
441
442
GskRenderNode *         gsk_rounded_clip_node_new               (GskRenderNode            *child,
                                                                 const GskRoundedRect     *clip);
Matthias Clasen's avatar
Matthias Clasen committed
443
GDK_AVAILABLE_IN_ALL
444
GskRenderNode *         gsk_rounded_clip_node_get_child         (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
445
GDK_AVAILABLE_IN_ALL
446
const GskRoundedRect *  gsk_rounded_clip_node_get_clip          (const GskRenderNode      *node) G_GNUC_PURE;
447

448
449
GDK_AVAILABLE_IN_ALL
GType                   gsk_shadow_node_get_type                (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
450
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
451
452
453
GskRenderNode *         gsk_shadow_node_new                     (GskRenderNode            *child,
                                                                 const GskShadow          *shadows,
                                                                 gsize                     n_shadows);
Matthias Clasen's avatar
Matthias Clasen committed
454
GDK_AVAILABLE_IN_ALL
455
GskRenderNode *         gsk_shadow_node_get_child               (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
456
GDK_AVAILABLE_IN_ALL
457
const GskShadow *       gsk_shadow_node_get_shadow              (const GskRenderNode      *node,
458
                                                                 gsize                     i) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
459
GDK_AVAILABLE_IN_ALL
460
gsize                   gsk_shadow_node_get_n_shadows           (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
461

462
463
GDK_AVAILABLE_IN_ALL
GType                   gsk_blend_node_get_type                 (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
464
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
465
466
467
GskRenderNode *         gsk_blend_node_new                      (GskRenderNode            *bottom,
                                                                 GskRenderNode            *top,
                                                                 GskBlendMode              blend_mode);
Matthias Clasen's avatar
Matthias Clasen committed
468
GDK_AVAILABLE_IN_ALL
469
GskRenderNode *         gsk_blend_node_get_bottom_child         (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
470
GDK_AVAILABLE_IN_ALL
471
GskRenderNode *         gsk_blend_node_get_top_child            (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
472
GDK_AVAILABLE_IN_ALL
473
GskBlendMode            gsk_blend_node_get_blend_mode           (const GskRenderNode      *node) G_GNUC_PURE;
474

475
476
GDK_AVAILABLE_IN_ALL
GType                   gsk_cross_fade_node_get_type            (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
477
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
478
479
GskRenderNode *         gsk_cross_fade_node_new                 (GskRenderNode            *start,
                                                                 GskRenderNode            *end,
480
                                                                 float                     progress);
Matthias Clasen's avatar
Matthias Clasen committed
481
GDK_AVAILABLE_IN_ALL
482
GskRenderNode *         gsk_cross_fade_node_get_start_child     (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
483
GDK_AVAILABLE_IN_ALL
484
GskRenderNode *         gsk_cross_fade_node_get_end_child       (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
485
GDK_AVAILABLE_IN_ALL
486
float                   gsk_cross_fade_node_get_progress        (const GskRenderNode      *node) G_GNUC_PURE;
Benjamin Otte's avatar
Benjamin Otte committed
487

488
489
GDK_AVAILABLE_IN_ALL
GType                   gsk_text_node_get_type                  (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
490
GDK_AVAILABLE_IN_ALL
491
492
493
GskRenderNode *         gsk_text_node_new                       (PangoFont                *font,
                                                                 PangoGlyphString         *glyphs,
                                                                 const GdkRGBA            *color,
494
                                                                 const graphene_point_t   *offset);
Matthias Clasen's avatar
Matthias Clasen committed
495
GDK_AVAILABLE_IN_ALL
496
PangoFont *             gsk_text_node_get_font                  (const GskRenderNode      *node) G_GNUC_PURE;
497
GDK_AVAILABLE_IN_ALL
498
gboolean                gsk_text_node_has_color_glyphs          (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
499
GDK_AVAILABLE_IN_ALL
500
guint                   gsk_text_node_get_num_glyphs            (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
501
GDK_AVAILABLE_IN_ALL
502
const PangoGlyphInfo   *gsk_text_node_get_glyphs                (const GskRenderNode      *node,
503
                                                                 guint                    *n_glyphs) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
504
GDK_AVAILABLE_IN_ALL
505
const GdkRGBA *         gsk_text_node_get_color                 (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
506
GDK_AVAILABLE_IN_ALL
507
const graphene_point_t *gsk_text_node_get_offset                (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
508

509
510
GDK_AVAILABLE_IN_ALL
GType                   gsk_blur_node_get_type                  (void) G_GNUC_CONST;
Matthias Clasen's avatar
Matthias Clasen committed
511
GDK_AVAILABLE_IN_ALL
512
GskRenderNode *         gsk_blur_node_new                       (GskRenderNode            *child,
513
                                                                 float                     radius);
Matthias Clasen's avatar
Matthias Clasen committed
514
GDK_AVAILABLE_IN_ALL
515
GskRenderNode *         gsk_blur_node_get_child                 (const GskRenderNode      *node) G_GNUC_PURE;
Matthias Clasen's avatar
Matthias Clasen committed
516
GDK_AVAILABLE_IN_ALL
517
float                   gsk_blur_node_get_radius                (const GskRenderNode      *node) G_GNUC_PURE;
518

519
520
521
522
523
524
525
526
527
GDK_AVAILABLE_IN_ALL
GType                   gsk_gl_shader_node_get_type              (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GskRenderNode *         gsk_gl_shader_node_new                  (GskGLShader              *shader,
                                                                 const graphene_rect_t    *bounds,
                                                                 GBytes                   *args,
                                                                 GskRenderNode           **children,
                                                                 guint                     n_children);
GDK_AVAILABLE_IN_ALL
528
guint                   gsk_gl_shader_node_get_n_children       (const GskRenderNode      *node) G_GNUC_PURE;
529
GDK_AVAILABLE_IN_ALL
530
GskRenderNode *         gsk_gl_shader_node_get_child            (const GskRenderNode      *node,
531
                                                                 guint                     idx) G_GNUC_PURE;
532
GDK_AVAILABLE_IN_ALL
533
GBytes *                gsk_gl_shader_node_get_args             (const GskRenderNode      *node) G_GNUC_PURE;
534
GDK_AVAILABLE_IN_ALL
535
GskGLShader *           gsk_gl_shader_node_get_shader           (const GskRenderNode      *node) G_GNUC_PURE;
536

537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
/**
 * GSK_VALUE_HOLDS_RENDER_NODE:
 * @value: a `GValue`
 *
 * Evaluates to %TRUE if @value was initialized with %GSK_TYPE_RENDER_NODE.
 */
#define GSK_VALUE_HOLDS_RENDER_NODE(value)       (G_VALUE_HOLDS ((value), GSK_TYPE_RENDER_NODE))

GDK_AVAILABLE_IN_4_4
void                    gsk_value_set_render_node               (GValue                   *value,
                                                                 GskRenderNode            *node);
GDK_AVAILABLE_IN_4_4
void                    gsk_value_take_render_node              (GValue                   *value,
                                                                 GskRenderNode            *node);
GDK_AVAILABLE_IN_4_4
GskRenderNode *         gsk_value_get_render_node               (const GValue             *value);
GDK_AVAILABLE_IN_4_4
GskRenderNode *         gsk_value_dup_render_node               (const GValue             *value);


557
558
559
G_END_DECLS

#endif /* __GSK_RENDER_NODE_H__ */