1 | /* |
2 | * Copyright © 2019 Benjamin Otte |
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.1 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 | * Authors: Benjamin Otte <otte@gnome.org> |
18 | */ |
19 | |
20 | |
21 | #ifndef __GSK_TRANSFORM_H__ |
22 | #define __GSK_TRANSFORM_H__ |
23 | |
24 | #if !defined (__GSK_H_INSIDE__) && !defined (GTK_COMPILATION) |
25 | #error "Only <gsk/gsk.h> can be included directly." |
26 | #endif |
27 | |
28 | #include <gsk/gskenums.h> |
29 | #include <gsk/gsktypes.h> |
30 | |
31 | G_BEGIN_DECLS |
32 | |
33 | #define GSK_TYPE_TRANSFORM (gsk_transform_get_type ()) |
34 | |
35 | GDK_AVAILABLE_IN_ALL |
36 | GType gsk_transform_get_type (void) G_GNUC_CONST; |
37 | |
38 | GDK_AVAILABLE_IN_ALL |
39 | GskTransform * gsk_transform_ref (GskTransform *self); |
40 | GDK_AVAILABLE_IN_ALL |
41 | void gsk_transform_unref (GskTransform *self); |
42 | |
43 | GDK_AVAILABLE_IN_ALL |
44 | void gsk_transform_print (GskTransform *self, |
45 | GString *string); |
46 | GDK_AVAILABLE_IN_ALL |
47 | char * gsk_transform_to_string (GskTransform *self); |
48 | GDK_AVAILABLE_IN_ALL |
49 | gboolean gsk_transform_parse (const char *string, |
50 | GskTransform **out_transform); |
51 | GDK_AVAILABLE_IN_ALL |
52 | void gsk_transform_to_matrix (GskTransform *self, |
53 | graphene_matrix_t *out_matrix); |
54 | GDK_AVAILABLE_IN_ALL |
55 | void gsk_transform_to_2d (GskTransform *self, |
56 | float *out_xx, |
57 | float *out_yx, |
58 | float *out_xy, |
59 | float *out_yy, |
60 | float *out_dx, |
61 | float *out_dy); |
62 | GDK_AVAILABLE_IN_4_6 |
63 | void gsk_transform_to_2d_components (GskTransform *self, |
64 | float *out_skew_x, |
65 | float *out_skew_y, |
66 | float *out_scale_x, |
67 | float *out_scale_y, |
68 | float *out_angle, |
69 | float *out_dx, |
70 | float *out_dy); |
71 | GDK_AVAILABLE_IN_ALL |
72 | void gsk_transform_to_affine (GskTransform *self, |
73 | float *out_scale_x, |
74 | float *out_scale_y, |
75 | float *out_dx, |
76 | float *out_dy); |
77 | GDK_AVAILABLE_IN_ALL |
78 | void gsk_transform_to_translate (GskTransform *self, |
79 | float *out_dx, |
80 | float *out_dy); |
81 | |
82 | GDK_AVAILABLE_IN_ALL |
83 | GskTransformCategory gsk_transform_get_category (GskTransform *self) G_GNUC_PURE; |
84 | GDK_AVAILABLE_IN_ALL |
85 | gboolean gsk_transform_equal (GskTransform *first, |
86 | GskTransform *second) G_GNUC_PURE; |
87 | |
88 | GDK_AVAILABLE_IN_ALL |
89 | GskTransform * gsk_transform_new (void); |
90 | GDK_AVAILABLE_IN_ALL |
91 | GskTransform * gsk_transform_transform (GskTransform *next, |
92 | GskTransform *other) G_GNUC_WARN_UNUSED_RESULT; |
93 | GDK_AVAILABLE_IN_ALL |
94 | GskTransform * gsk_transform_invert (GskTransform *self) G_GNUC_WARN_UNUSED_RESULT; |
95 | GDK_AVAILABLE_IN_ALL |
96 | GskTransform * gsk_transform_matrix (GskTransform *next, |
97 | const graphene_matrix_t *matrix) G_GNUC_WARN_UNUSED_RESULT; |
98 | GDK_AVAILABLE_IN_ALL |
99 | GskTransform * gsk_transform_translate (GskTransform *next, |
100 | const graphene_point_t *point) G_GNUC_WARN_UNUSED_RESULT; |
101 | GDK_AVAILABLE_IN_ALL |
102 | GskTransform * gsk_transform_translate_3d (GskTransform *next, |
103 | const graphene_point3d_t *point) G_GNUC_WARN_UNUSED_RESULT; |
104 | GDK_AVAILABLE_IN_4_6 |
105 | GskTransform * gsk_transform_skew (GskTransform *next, |
106 | float skew_x, |
107 | float skew_y) G_GNUC_WARN_UNUSED_RESULT; |
108 | GDK_AVAILABLE_IN_ALL |
109 | GskTransform * gsk_transform_rotate (GskTransform *next, |
110 | float angle) G_GNUC_WARN_UNUSED_RESULT; |
111 | GDK_AVAILABLE_IN_ALL |
112 | GskTransform * gsk_transform_rotate_3d (GskTransform *next, |
113 | float angle, |
114 | const graphene_vec3_t *axis) G_GNUC_WARN_UNUSED_RESULT; |
115 | GDK_AVAILABLE_IN_ALL |
116 | GskTransform * gsk_transform_scale (GskTransform *next, |
117 | float factor_x, |
118 | float factor_y) G_GNUC_WARN_UNUSED_RESULT; |
119 | GDK_AVAILABLE_IN_ALL |
120 | GskTransform * gsk_transform_scale_3d (GskTransform *next, |
121 | float factor_x, |
122 | float factor_y, |
123 | float factor_z) G_GNUC_WARN_UNUSED_RESULT; |
124 | GDK_AVAILABLE_IN_ALL |
125 | GskTransform * gsk_transform_perspective (GskTransform *next, |
126 | float depth) G_GNUC_WARN_UNUSED_RESULT; |
127 | |
128 | GDK_AVAILABLE_IN_ALL |
129 | void gsk_transform_transform_bounds (GskTransform *self, |
130 | const graphene_rect_t *rect, |
131 | graphene_rect_t *out_rect); |
132 | GDK_AVAILABLE_IN_ALL |
133 | void gsk_transform_transform_point (GskTransform *self, |
134 | const graphene_point_t *point, |
135 | graphene_point_t *out_point); |
136 | |
137 | |
138 | G_END_DECLS |
139 | |
140 | #endif /* __GSK_TRANSFORM_H__ */ |
141 | |