1 | /* GdkPixbuf library - transformations |
2 | * |
3 | * Copyright (C) 2003 The Free Software Foundation |
4 | * |
5 | * Authors: Mark Crichton <crichton@gimp.org> |
6 | * Miguel de Icaza <miguel@gnu.org> |
7 | * Federico Mena-Quintero <federico@gimp.org> |
8 | * Havoc Pennington <hp@redhat.com> |
9 | * |
10 | * This library is free software; you can redistribute it and/or |
11 | * modify it under the terms of the GNU Lesser General Public |
12 | * License as published by the Free Software Foundation; either |
13 | * version 2 of the License, or (at your option) any later version. |
14 | * |
15 | * This library is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 | * Lesser General Public License for more details. |
19 | * |
20 | * You should have received a copy of the GNU Lesser General Public |
21 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
22 | */ |
23 | |
24 | #ifndef GDK_PIXBUF_TRANSFORM_H |
25 | #define GDK_PIXBUF_TRANSFORM_H |
26 | |
27 | #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION) |
28 | #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly." |
29 | #endif |
30 | |
31 | #include <glib.h> |
32 | #include <gdk-pixbuf/gdk-pixbuf-core.h> |
33 | |
34 | |
35 | G_BEGIN_DECLS |
36 | |
37 | /* Scaling */ |
38 | |
39 | /** |
40 | * GdkInterpType: |
41 | * @GDK_INTERP_NEAREST: Nearest neighbor sampling; this is the fastest |
42 | * and lowest quality mode. Quality is normally unacceptable when scaling |
43 | * down, but may be OK when scaling up. |
44 | * @GDK_INTERP_TILES: This is an accurate simulation of the PostScript |
45 | * image operator without any interpolation enabled. Each pixel is |
46 | * rendered as a tiny parallelogram of solid color, the edges of which |
47 | * are implemented with antialiasing. It resembles nearest neighbor for |
48 | * enlargement, and bilinear for reduction. |
49 | * @GDK_INTERP_BILINEAR: Best quality/speed balance; use this mode by |
50 | * default. Bilinear interpolation. For enlargement, it is |
51 | * equivalent to point-sampling the ideal bilinear-interpolated image. |
52 | * For reduction, it is equivalent to laying down small tiles and |
53 | * integrating over the coverage area. |
54 | * @GDK_INTERP_HYPER: This is the slowest and highest quality |
55 | * reconstruction function. It is derived from the hyperbolic filters in |
56 | * Wolberg's "Digital Image Warping", and is formally defined as the |
57 | * hyperbolic-filter sampling the ideal hyperbolic-filter interpolated |
58 | * image (the filter is designed to be idempotent for 1:1 pixel mapping). |
59 | * **Deprecated**: this interpolation filter is deprecated, as in reality |
60 | * it has a lower quality than the @GDK_INTERP_BILINEAR filter |
61 | * (Since: 2.38) |
62 | * |
63 | * Interpolation modes for scaling functions. |
64 | * |
65 | * The `GDK_INTERP_NEAREST` mode is the fastest scaling method, but has |
66 | * horrible quality when scaling down; `GDK_INTERP_BILINEAR` is the best |
67 | * choice if you aren't sure what to choose, it has a good speed/quality |
68 | * balance. |
69 | * |
70 | * **Note**: Cubic filtering is missing from the list; hyperbolic |
71 | * interpolation is just as fast and results in higher quality. |
72 | */ |
73 | typedef enum { |
74 | GDK_INTERP_NEAREST, |
75 | GDK_INTERP_TILES, |
76 | GDK_INTERP_BILINEAR, |
77 | GDK_INTERP_HYPER |
78 | } GdkInterpType; |
79 | |
80 | /** |
81 | * GdkPixbufRotation: |
82 | * @GDK_PIXBUF_ROTATE_NONE: No rotation. |
83 | * @GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE: Rotate by 90 degrees. |
84 | * @GDK_PIXBUF_ROTATE_UPSIDEDOWN: Rotate by 180 degrees. |
85 | * @GDK_PIXBUF_ROTATE_CLOCKWISE: Rotate by 270 degrees. |
86 | * |
87 | * The possible rotations which can be passed to gdk_pixbuf_rotate_simple(). |
88 | * |
89 | * To make them easier to use, their numerical values are the actual degrees. |
90 | */ |
91 | typedef enum { |
92 | GDK_PIXBUF_ROTATE_NONE = 0, |
93 | GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE = 90, |
94 | GDK_PIXBUF_ROTATE_UPSIDEDOWN = 180, |
95 | GDK_PIXBUF_ROTATE_CLOCKWISE = 270 |
96 | } GdkPixbufRotation; |
97 | |
98 | GDK_PIXBUF_AVAILABLE_IN_ALL |
99 | void gdk_pixbuf_scale (const GdkPixbuf *src, |
100 | GdkPixbuf *dest, |
101 | int dest_x, |
102 | int dest_y, |
103 | int dest_width, |
104 | int dest_height, |
105 | double offset_x, |
106 | double offset_y, |
107 | double scale_x, |
108 | double scale_y, |
109 | GdkInterpType interp_type); |
110 | GDK_PIXBUF_AVAILABLE_IN_ALL |
111 | void gdk_pixbuf_composite (const GdkPixbuf *src, |
112 | GdkPixbuf *dest, |
113 | int dest_x, |
114 | int dest_y, |
115 | int dest_width, |
116 | int dest_height, |
117 | double offset_x, |
118 | double offset_y, |
119 | double scale_x, |
120 | double scale_y, |
121 | GdkInterpType interp_type, |
122 | int overall_alpha); |
123 | GDK_PIXBUF_AVAILABLE_IN_ALL |
124 | void gdk_pixbuf_composite_color (const GdkPixbuf *src, |
125 | GdkPixbuf *dest, |
126 | int dest_x, |
127 | int dest_y, |
128 | int dest_width, |
129 | int dest_height, |
130 | double offset_x, |
131 | double offset_y, |
132 | double scale_x, |
133 | double scale_y, |
134 | GdkInterpType interp_type, |
135 | int overall_alpha, |
136 | int check_x, |
137 | int check_y, |
138 | int check_size, |
139 | guint32 color1, |
140 | guint32 color2); |
141 | |
142 | GDK_PIXBUF_AVAILABLE_IN_ALL |
143 | GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src, |
144 | int dest_width, |
145 | int dest_height, |
146 | GdkInterpType interp_type); |
147 | |
148 | GDK_PIXBUF_AVAILABLE_IN_ALL |
149 | GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src, |
150 | int dest_width, |
151 | int dest_height, |
152 | GdkInterpType interp_type, |
153 | int overall_alpha, |
154 | int check_size, |
155 | guint32 color1, |
156 | guint32 color2); |
157 | |
158 | GDK_PIXBUF_AVAILABLE_IN_2_6 |
159 | GdkPixbuf *gdk_pixbuf_rotate_simple (const GdkPixbuf *src, |
160 | GdkPixbufRotation angle); |
161 | GDK_PIXBUF_AVAILABLE_IN_2_6 |
162 | GdkPixbuf *gdk_pixbuf_flip (const GdkPixbuf *src, |
163 | gboolean horizontal); |
164 | |
165 | G_END_DECLS |
166 | |
167 | |
168 | #endif /* GDK_PIXBUF_TRANSFORM_H */ |
169 | |