1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995-2001 Spencer Kimball, Peter Mattis, and others
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program 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
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __GIMP_TRANSFORM_UTILS_H__
19 #define __GIMP_TRANSFORM_UTILS_H__
20 
21 
22 #define GIMP_TRANSFORM_NEAR_Z 0.02
23 
24 
25 void       gimp_transform_get_rotate_center    (gint                 x,
26                                                 gint                 y,
27                                                 gint                 width,
28                                                 gint                 height,
29                                                 gboolean             auto_center,
30                                                 gdouble             *center_x,
31                                                 gdouble             *center_y);
32 void       gimp_transform_get_flip_axis        (gint                 x,
33                                                 gint                 y,
34                                                 gint                 width,
35                                                 gint                 height,
36                                                 GimpOrientationType  flip_type,
37                                                 gboolean             auto_center,
38                                                 gdouble             *axis);
39 
40 void       gimp_transform_matrix_flip          (GimpMatrix3         *matrix,
41                                                 GimpOrientationType  flip_type,
42                                                 gdouble              axis);
43 void       gimp_transform_matrix_flip_free     (GimpMatrix3         *matrix,
44                                                 gdouble              x1,
45                                                 gdouble              y1,
46                                                 gdouble              x2,
47                                                 gdouble              y2);
48 void       gimp_transform_matrix_rotate        (GimpMatrix3         *matrix,
49                                                 GimpRotationType     rotate_type,
50                                                 gdouble              center_x,
51                                                 gdouble              center_y);
52 void       gimp_transform_matrix_rotate_rect   (GimpMatrix3         *matrix,
53                                                 gint                 x,
54                                                 gint                 y,
55                                                 gint                 width,
56                                                 gint                 height,
57                                                 gdouble              angle);
58 void       gimp_transform_matrix_rotate_center (GimpMatrix3         *matrix,
59                                                 gdouble              center_x,
60                                                 gdouble              center_y,
61                                                 gdouble              angle);
62 void       gimp_transform_matrix_scale         (GimpMatrix3         *matrix,
63                                                 gint                 x,
64                                                 gint                 y,
65                                                 gint                 width,
66                                                 gint                 height,
67                                                 gdouble              t_x,
68                                                 gdouble              t_y,
69                                                 gdouble              t_width,
70                                                 gdouble              t_height);
71 void       gimp_transform_matrix_shear         (GimpMatrix3         *matrix,
72                                                 gint                 x,
73                                                 gint                 y,
74                                                 gint                 width,
75                                                 gint                 height,
76                                                 GimpOrientationType  orientation,
77                                                 gdouble              amount);
78 void       gimp_transform_matrix_perspective   (GimpMatrix3         *matrix,
79                                                 gint                 x,
80                                                 gint                 y,
81                                                 gint                 width,
82                                                 gint                 height,
83                                                 gdouble              t_x1,
84                                                 gdouble              t_y1,
85                                                 gdouble              t_x2,
86                                                 gdouble              t_y2,
87                                                 gdouble              t_x3,
88                                                 gdouble              t_y3,
89                                                 gdouble              t_x4,
90                                                 gdouble              t_y4);
91 gboolean   gimp_transform_matrix_generic       (GimpMatrix3         *matrix,
92                                                 const GimpVector2    input_points[4],
93                                                 const GimpVector2    output_points[4]);
94 
95 gboolean   gimp_transform_polygon_is_convex    (gdouble              x1,
96                                                 gdouble              y1,
97                                                 gdouble              x2,
98                                                 gdouble              y2,
99                                                 gdouble              x3,
100                                                 gdouble              y3,
101                                                 gdouble              x4,
102                                                 gdouble              y4);
103 
104 void       gimp_transform_polygon              (const GimpMatrix3   *matrix,
105                                                 const GimpVector2   *vertices,
106                                                 gint                 n_vertices,
107                                                 gboolean             closed,
108                                                 GimpVector2         *t_vertices,
109                                                 gint                *n_t_vertices);
110 void       gimp_transform_polygon_coords       (const GimpMatrix3   *matrix,
111                                                 const GimpCoords    *vertices,
112                                                 gint                 n_vertices,
113                                                 gboolean             closed,
114                                                 GimpCoords          *t_vertices,
115                                                 gint                *n_t_vertices);
116 
117 void       gimp_transform_bezier_coords        (const GimpMatrix3   *matrix,
118                                                 const GimpCoords     bezier[4],
119                                                 GQueue              *t_beziers[2],
120                                                 gint                *n_t_beziers,
121                                                 gboolean            *start_in,
122                                                 gboolean            *end_in);
123 
124 
125 #endif  /*  __GIMP_TRANSFORM_UTILS_H__  */
126