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
35G_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 * This enumeration describes the different interpolation modes that
64 * can be used with the scaling functions. @GDK_INTERP_NEAREST is
65 * the fastest scaling method, but has horrible quality when
66 * scaling down. @GDK_INTERP_BILINEAR is the best choice if you
67 * aren't sure what to choose, it has a good speed/quality balance.
68 *
69 * **Note**: Cubic filtering is missing from the list; hyperbolic
70 * interpolation is just as fast and results in higher quality.
71 */
72typedef enum {
73 GDK_INTERP_NEAREST,
74 GDK_INTERP_TILES,
75 GDK_INTERP_BILINEAR,
76 GDK_INTERP_HYPER
77} GdkInterpType;
78
79/**
80 * GdkPixbufRotation:
81 * @GDK_PIXBUF_ROTATE_NONE: No rotation.
82 * @GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE: Rotate by 90 degrees.
83 * @GDK_PIXBUF_ROTATE_UPSIDEDOWN: Rotate by 180 degrees.
84 * @GDK_PIXBUF_ROTATE_CLOCKWISE: Rotate by 270 degrees.
85 *
86 * The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
87 * To make them easier to use, their numerical values are the actual degrees.
88 */
89typedef enum {
90 GDK_PIXBUF_ROTATE_NONE = 0,
91 GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE = 90,
92 GDK_PIXBUF_ROTATE_UPSIDEDOWN = 180,
93 GDK_PIXBUF_ROTATE_CLOCKWISE = 270
94} GdkPixbufRotation;
95
96GDK_PIXBUF_AVAILABLE_IN_ALL
97void gdk_pixbuf_scale (const GdkPixbuf *src,
98 GdkPixbuf *dest,
99 int dest_x,
100 int dest_y,
101 int dest_width,
102 int dest_height,
103 double offset_x,
104 double offset_y,
105 double scale_x,
106 double scale_y,
107 GdkInterpType interp_type);
108GDK_PIXBUF_AVAILABLE_IN_ALL
109void gdk_pixbuf_composite (const GdkPixbuf *src,
110 GdkPixbuf *dest,
111 int dest_x,
112 int dest_y,
113 int dest_width,
114 int dest_height,
115 double offset_x,
116 double offset_y,
117 double scale_x,
118 double scale_y,
119 GdkInterpType interp_type,
120 int overall_alpha);
121GDK_PIXBUF_AVAILABLE_IN_ALL
122void gdk_pixbuf_composite_color (const GdkPixbuf *src,
123 GdkPixbuf *dest,
124 int dest_x,
125 int dest_y,
126 int dest_width,
127 int dest_height,
128 double offset_x,
129 double offset_y,
130 double scale_x,
131 double scale_y,
132 GdkInterpType interp_type,
133 int overall_alpha,
134 int check_x,
135 int check_y,
136 int check_size,
137 guint32 color1,
138 guint32 color2);
139
140GDK_PIXBUF_AVAILABLE_IN_ALL
141GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
142 int dest_width,
143 int dest_height,
144 GdkInterpType interp_type);
145
146GDK_PIXBUF_AVAILABLE_IN_ALL
147GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
148 int dest_width,
149 int dest_height,
150 GdkInterpType interp_type,
151 int overall_alpha,
152 int check_size,
153 guint32 color1,
154 guint32 color2);
155
156GDK_PIXBUF_AVAILABLE_IN_2_6
157GdkPixbuf *gdk_pixbuf_rotate_simple (const GdkPixbuf *src,
158 GdkPixbufRotation angle);
159GDK_PIXBUF_AVAILABLE_IN_2_6
160GdkPixbuf *gdk_pixbuf_flip (const GdkPixbuf *src,
161 gboolean horizontal);
162
163G_END_DECLS
164
165
166#endif /* GDK_PIXBUF_TRANSFORM_H */
167