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