1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2016 Benjamin Otte <otte@gnome.org>
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 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24 
25 #ifndef __GTK_SNAPSHOT_H__
26 #define __GTK_SNAPSHOT_H__
27 
28 
29 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
30 #error "Only <gtk/gtk.h> can be included directly."
31 #endif
32 
33 #include <gsk/gsk.h>
34 
35 #include <gtk/gtktypes.h>
36 
37 G_BEGIN_DECLS
38 
39 typedef struct _GtkSnapshotClass       GtkSnapshotClass;
40 
41 #define GTK_TYPE_SNAPSHOT               (gtk_snapshot_get_type ())
42 
43 #define GTK_SNAPSHOT(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SNAPSHOT, GtkSnapshot))
44 #define GTK_IS_SNAPSHOT(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SNAPSHOT))
45 
46 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSnapshot, g_object_unref)
47 
48 
49 
50 GDK_AVAILABLE_IN_ALL
51 GType           gtk_snapshot_get_type                   (void) G_GNUC_CONST;
52 
53 GDK_AVAILABLE_IN_ALL
54 GtkSnapshot *   gtk_snapshot_new                        (void);
55 GDK_AVAILABLE_IN_ALL
56 GskRenderNode * gtk_snapshot_free_to_node               (GtkSnapshot            *snapshot);
57 GDK_AVAILABLE_IN_ALL
58 GdkPaintable *  gtk_snapshot_free_to_paintable          (GtkSnapshot            *snapshot,
59                                                          const graphene_size_t  *size);
60 
61 GDK_AVAILABLE_IN_ALL
62 GskRenderNode * gtk_snapshot_to_node                    (GtkSnapshot            *snapshot);
63 GDK_AVAILABLE_IN_ALL
64 GdkPaintable *  gtk_snapshot_to_paintable               (GtkSnapshot            *snapshot,
65                                                          const graphene_size_t  *size);
66 
67 GDK_AVAILABLE_IN_ALL
68 void            gtk_snapshot_push_debug                 (GtkSnapshot            *snapshot,
69                                                          const char             *message,
70                                                          ...) G_GNUC_PRINTF (2, 3);
71 GDK_AVAILABLE_IN_ALL
72 void            gtk_snapshot_push_opacity               (GtkSnapshot            *snapshot,
73                                                          double                  opacity);
74 GDK_AVAILABLE_IN_ALL
75 void            gtk_snapshot_push_blur                  (GtkSnapshot            *snapshot,
76                                                          double                  radius);
77 GDK_AVAILABLE_IN_ALL
78 void            gtk_snapshot_push_color_matrix          (GtkSnapshot            *snapshot,
79                                                          const graphene_matrix_t*color_matrix,
80                                                          const graphene_vec4_t  *color_offset);
81 GDK_AVAILABLE_IN_ALL
82 void            gtk_snapshot_push_repeat                (GtkSnapshot            *snapshot,
83                                                          const graphene_rect_t  *bounds,
84                                                          const graphene_rect_t  *child_bounds);
85 GDK_AVAILABLE_IN_ALL
86 void            gtk_snapshot_push_clip                  (GtkSnapshot            *snapshot,
87                                                          const graphene_rect_t  *bounds);
88 GDK_AVAILABLE_IN_ALL
89 void            gtk_snapshot_push_rounded_clip          (GtkSnapshot            *snapshot,
90                                                          const GskRoundedRect   *bounds);
91 GDK_AVAILABLE_IN_ALL
92 void            gtk_snapshot_push_shadow                (GtkSnapshot            *snapshot,
93                                                          const GskShadow        *shadow,
94                                                          gsize                   n_shadows);
95 GDK_AVAILABLE_IN_ALL
96 void            gtk_snapshot_push_blend                 (GtkSnapshot            *snapshot,
97                                                          GskBlendMode            blend_mode);
98 GDK_AVAILABLE_IN_ALL
99 void            gtk_snapshot_push_cross_fade            (GtkSnapshot            *snapshot,
100                                                          double                  progress);
101 GDK_AVAILABLE_IN_ALL
102 void            gtk_snapshot_push_gl_shader             (GtkSnapshot            *snapshot,
103                                                          GskGLShader            *shader,
104                                                          const graphene_rect_t  *bounds,
105                                                          GBytes                 *take_args);
106 GDK_AVAILABLE_IN_ALL
107 void           gtk_snapshot_gl_shader_pop_texture       (GtkSnapshot            *snapshot);
108 GDK_AVAILABLE_IN_ALL
109 void            gtk_snapshot_pop                        (GtkSnapshot            *snapshot);
110 GDK_AVAILABLE_IN_ALL
111 void            gtk_snapshot_save                       (GtkSnapshot            *snapshot);
112 GDK_AVAILABLE_IN_ALL
113 void            gtk_snapshot_restore                    (GtkSnapshot            *snapshot);
114 GDK_AVAILABLE_IN_ALL
115 void            gtk_snapshot_transform                  (GtkSnapshot            *snapshot,
116                                                          GskTransform           *transform);
117 GDK_AVAILABLE_IN_ALL
118 void            gtk_snapshot_transform_matrix           (GtkSnapshot            *snapshot,
119                                                          const graphene_matrix_t*matrix);
120 GDK_AVAILABLE_IN_ALL
121 void            gtk_snapshot_translate                  (GtkSnapshot            *snapshot,
122                                                          const graphene_point_t *point);
123 GDK_AVAILABLE_IN_ALL
124 void            gtk_snapshot_translate_3d               (GtkSnapshot            *snapshot,
125                                                          const graphene_point3d_t*point);
126 GDK_AVAILABLE_IN_ALL
127 void            gtk_snapshot_rotate                     (GtkSnapshot            *snapshot,
128                                                          float                  angle);
129 GDK_AVAILABLE_IN_ALL
130 void            gtk_snapshot_rotate_3d                  (GtkSnapshot            *snapshot,
131                                                          float                   angle,
132                                                          const graphene_vec3_t  *axis);
133 GDK_AVAILABLE_IN_ALL
134 void            gtk_snapshot_scale                      (GtkSnapshot            *snapshot,
135                                                          float                   factor_x,
136                                                          float                   factor_y);
137 GDK_AVAILABLE_IN_ALL
138 void            gtk_snapshot_scale_3d                   (GtkSnapshot            *snapshot,
139                                                          float                   factor_x,
140                                                          float                   factor_y,
141                                                          float                   factor_z);
142 GDK_AVAILABLE_IN_ALL
143 void            gtk_snapshot_perspective                (GtkSnapshot            *snapshot,
144                                                          float                   depth);
145 GDK_AVAILABLE_IN_ALL
146 void            gtk_snapshot_append_node                (GtkSnapshot            *snapshot,
147                                                          GskRenderNode          *node);
148 GDK_AVAILABLE_IN_ALL
149 cairo_t *       gtk_snapshot_append_cairo               (GtkSnapshot            *snapshot,
150                                                          const graphene_rect_t  *bounds);
151 GDK_AVAILABLE_IN_ALL
152 void            gtk_snapshot_append_texture             (GtkSnapshot            *snapshot,
153                                                          GdkTexture             *texture,
154                                                          const graphene_rect_t  *bounds);
155 GDK_AVAILABLE_IN_ALL
156 void            gtk_snapshot_append_color               (GtkSnapshot            *snapshot,
157                                                          const GdkRGBA          *color,
158                                                          const graphene_rect_t  *bounds);
159 GDK_AVAILABLE_IN_ALL
160 void            gtk_snapshot_append_linear_gradient     (GtkSnapshot            *snapshot,
161                                                          const graphene_rect_t  *bounds,
162                                                          const graphene_point_t *start_point,
163                                                          const graphene_point_t *end_point,
164                                                          const GskColorStop     *stops,
165                                                          gsize                   n_stops);
166 GDK_AVAILABLE_IN_ALL
167 void            gtk_snapshot_append_repeating_linear_gradient (GtkSnapshot            *snapshot,
168                                                                const graphene_rect_t  *bounds,
169                                                                const graphene_point_t *start_point,
170                                                                const graphene_point_t *end_point,
171                                                                const GskColorStop     *stops,
172                                                                gsize                   n_stops);
173 GDK_AVAILABLE_IN_ALL
174 void            gtk_snapshot_append_radial_gradient     (GtkSnapshot            *snapshot,
175                                                          const graphene_rect_t  *bounds,
176                                                          const graphene_point_t *center,
177                                                          float                   hradius,
178                                                          float                   vradius,
179                                                          float                   start,
180                                                          float                   end,
181                                                          const GskColorStop     *stops,
182                                                          gsize                   n_stops);
183 GDK_AVAILABLE_IN_ALL
184 void            gtk_snapshot_append_repeating_radial_gradient (GtkSnapshot            *snapshot,
185                                                                const graphene_rect_t  *bounds,
186                                                                const graphene_point_t *center,
187                                                                float                   hradius,
188                                                                float                   vradius,
189                                                                float                   start,
190                                                                float                   end,
191                                                                const GskColorStop     *stops,
192                                                                gsize                   n_stops);
193 GDK_AVAILABLE_IN_ALL
194 void            gtk_snapshot_append_conic_gradient      (GtkSnapshot            *snapshot,
195                                                          const graphene_rect_t  *bounds,
196                                                          const graphene_point_t *center,
197                                                          float                   rotation,
198                                                          const GskColorStop     *stops,
199                                                          gsize                   n_stops);
200 GDK_AVAILABLE_IN_ALL
201 void            gtk_snapshot_append_border              (GtkSnapshot            *snapshot,
202                                                          const GskRoundedRect   *outline,
203                                                          const float             border_width[4],
204                                                          const GdkRGBA           border_color[4]);
205 GDK_AVAILABLE_IN_ALL
206 void            gtk_snapshot_append_inset_shadow        (GtkSnapshot            *snapshot,
207                                                          const GskRoundedRect   *outline,
208                                                          const GdkRGBA          *color,
209                                                          float                   dx,
210                                                          float                   dy,
211                                                          float                   spread,
212                                                          float                   blur_radius);
213 GDK_AVAILABLE_IN_ALL
214 void            gtk_snapshot_append_outset_shadow       (GtkSnapshot            *snapshot,
215                                                          const GskRoundedRect   *outline,
216                                                          const GdkRGBA          *color,
217                                                          float                   dx,
218                                                          float                   dy,
219                                                          float                   spread,
220                                                          float                   blur_radius);
221 /* next function implemented in gskpango.c */
222 GDK_AVAILABLE_IN_ALL
223 void            gtk_snapshot_append_layout              (GtkSnapshot            *snapshot,
224                                                          PangoLayout            *layout,
225                                                          const GdkRGBA          *color);
226 
227 
228 GDK_AVAILABLE_IN_ALL
229 void            gtk_snapshot_render_background          (GtkSnapshot            *snapshot,
230                                                          GtkStyleContext        *context,
231                                                          double                  x,
232                                                          double                  y,
233                                                          double                  width,
234                                                          double                  height);
235 GDK_AVAILABLE_IN_ALL
236 void            gtk_snapshot_render_frame               (GtkSnapshot            *snapshot,
237                                                          GtkStyleContext        *context,
238                                                          double                  x,
239                                                          double                  y,
240                                                          double                  width,
241                                                          double                  height);
242 GDK_AVAILABLE_IN_ALL
243 void            gtk_snapshot_render_focus               (GtkSnapshot            *snapshot,
244                                                          GtkStyleContext        *context,
245                                                          double                  x,
246                                                          double                  y,
247                                                          double                  width,
248                                                          double                  height);
249 GDK_AVAILABLE_IN_ALL
250 void            gtk_snapshot_render_layout              (GtkSnapshot            *snapshot,
251                                                          GtkStyleContext        *context,
252                                                          double                  x,
253                                                          double                  y,
254                                                          PangoLayout            *layout);
255 GDK_AVAILABLE_IN_ALL /* in gtkstylecontext.c */
256 void            gtk_snapshot_render_insertion_cursor    (GtkSnapshot            *snapshot,
257                                                          GtkStyleContext        *context,
258                                                          double                  x,
259                                                          double                  y,
260                                                          PangoLayout            *layout,
261                                                          int                     index,
262                                                          PangoDirection          direction);
263 
264 
265 G_END_DECLS
266 
267 #endif /* __GTK_SNAPSHOT_H__ */
268