Blame gdk-pixbuf/gdk-pixbuf-transform.h

Packit a4058c
/* GdkPixbuf library - transformations
Packit a4058c
 *
Packit a4058c
 * Copyright (C) 2003 The Free Software Foundation
Packit a4058c
 *
Packit a4058c
 * Authors: Mark Crichton <crichton@gimp.org>
Packit a4058c
 *          Miguel de Icaza <miguel@gnu.org>
Packit a4058c
 *          Federico Mena-Quintero <federico@gimp.org>
Packit a4058c
 *          Havoc Pennington <hp@redhat.com>
Packit a4058c
 *
Packit a4058c
 * This library is free software; you can redistribute it and/or
Packit a4058c
 * modify it under the terms of the GNU Lesser General Public
Packit a4058c
 * License as published by the Free Software Foundation; either
Packit a4058c
 * version 2 of the License, or (at your option) any later version.
Packit a4058c
 *
Packit a4058c
 * This library is distributed in the hope that it will be useful,
Packit a4058c
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit a4058c
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit a4058c
 * Lesser General Public License for more details.
Packit a4058c
 *
Packit a4058c
 * You should have received a copy of the GNU Lesser General Public
Packit a4058c
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit a4058c
 */
Packit a4058c
Packit a4058c
#ifndef GDK_PIXBUF_TRANSFORM_H
Packit a4058c
#define GDK_PIXBUF_TRANSFORM_H
Packit a4058c
Packit a4058c
#if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
Packit a4058c
#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
Packit a4058c
#endif
Packit a4058c
Packit a4058c
#include <glib.h>
Packit a4058c
#include <gdk-pixbuf/gdk-pixbuf-core.h>
Packit a4058c
Packit a4058c
Packit a4058c
G_BEGIN_DECLS
Packit a4058c
Packit a4058c
/* Scaling */
Packit a4058c
Packit a4058c
/**
Packit a4058c
 * GdkInterpType:
Packit a4058c
 * @GDK_INTERP_NEAREST: Nearest neighbor sampling; this is the fastest
Packit a4058c
 *  and lowest quality mode. Quality is normally unacceptable when scaling 
Packit a4058c
 *  down, but may be OK when scaling up.
Packit a4058c
 * @GDK_INTERP_TILES: This is an accurate simulation of the PostScript
Packit a4058c
 *  image operator without any interpolation enabled.  Each pixel is
Packit a4058c
 *  rendered as a tiny parallelogram of solid color, the edges of which
Packit a4058c
 *  are implemented with antialiasing.  It resembles nearest neighbor for
Packit a4058c
 *  enlargement, and bilinear for reduction.
Packit a4058c
 * @GDK_INTERP_BILINEAR: Best quality/speed balance; use this mode by
Packit a4058c
 *  default. Bilinear interpolation.  For enlargement, it is
Packit a4058c
 *  equivalent to point-sampling the ideal bilinear-interpolated image.
Packit a4058c
 *  For reduction, it is equivalent to laying down small tiles and
Packit a4058c
 *  integrating over the coverage area.
Packit a4058c
 * @GDK_INTERP_HYPER: This is the slowest and highest quality
Packit a4058c
 *  reconstruction function. It is derived from the hyperbolic filters in
Packit a4058c
 *  Wolberg's "Digital Image Warping", and is formally defined as the
Packit a4058c
 *  hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
Packit a4058c
 *  image (the filter is designed to be idempotent for 1:1 pixel mapping).
Packit a4058c
 * 
Packit a4058c
 *  This enumeration describes the different interpolation modes that
Packit a4058c
 *  can be used with the scaling functions. @GDK_INTERP_NEAREST is 
Packit a4058c
 *  the fastest scaling method, but has horrible quality when 
Packit a4058c
 *  scaling down. @GDK_INTERP_BILINEAR is the best choice if you 
Packit a4058c
 *  aren't sure what to choose, it has a good speed/quality balance.
Packit a4058c
 * 
Packit a4058c
 *  <note>
Packit a4058c
 * 	Cubic filtering is missing from the list; hyperbolic
Packit a4058c
 * 	interpolation is just as fast and results in higher quality.
Packit a4058c
 *  </note>
Packit a4058c
 */
Packit a4058c
typedef enum {
Packit a4058c
	GDK_INTERP_NEAREST,
Packit a4058c
	GDK_INTERP_TILES,
Packit a4058c
	GDK_INTERP_BILINEAR,
Packit a4058c
	GDK_INTERP_HYPER
Packit a4058c
} GdkInterpType;
Packit a4058c
Packit a4058c
/**
Packit a4058c
 * GdkPixbufRotation:
Packit a4058c
 * @GDK_PIXBUF_ROTATE_NONE: No rotation.
Packit a4058c
 * @GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE: Rotate by 90 degrees.
Packit a4058c
 * @GDK_PIXBUF_ROTATE_UPSIDEDOWN: Rotate by 180 degrees.
Packit a4058c
 * @GDK_PIXBUF_ROTATE_CLOCKWISE: Rotate by 270 degrees.
Packit a4058c
 * 
Packit a4058c
 * The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
Packit a4058c
 * To make them easier to use, their numerical values are the actual degrees.
Packit a4058c
 */
Packit a4058c
typedef enum {
Packit a4058c
	GDK_PIXBUF_ROTATE_NONE             =   0,
Packit a4058c
	GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE =  90,
Packit a4058c
	GDK_PIXBUF_ROTATE_UPSIDEDOWN       = 180,
Packit a4058c
	GDK_PIXBUF_ROTATE_CLOCKWISE        = 270
Packit a4058c
} GdkPixbufRotation;
Packit a4058c
Packit a4058c
GDK_PIXBUF_AVAILABLE_IN_ALL
Packit a4058c
void gdk_pixbuf_scale           (const GdkPixbuf *src,
Packit a4058c
				 GdkPixbuf       *dest,
Packit a4058c
				 int              dest_x,
Packit a4058c
				 int              dest_y,
Packit a4058c
				 int              dest_width,
Packit a4058c
				 int              dest_height,
Packit a4058c
				 double           offset_x,
Packit a4058c
				 double           offset_y,
Packit a4058c
				 double           scale_x,
Packit a4058c
				 double           scale_y,
Packit a4058c
				 GdkInterpType    interp_type);
Packit a4058c
GDK_PIXBUF_AVAILABLE_IN_ALL
Packit a4058c
void gdk_pixbuf_composite       (const GdkPixbuf *src,
Packit a4058c
				 GdkPixbuf       *dest,
Packit a4058c
				 int              dest_x,
Packit a4058c
				 int              dest_y,
Packit a4058c
				 int              dest_width,
Packit a4058c
				 int              dest_height,
Packit a4058c
				 double           offset_x,
Packit a4058c
				 double           offset_y,
Packit a4058c
				 double           scale_x,
Packit a4058c
				 double           scale_y,
Packit a4058c
				 GdkInterpType    interp_type,
Packit a4058c
				 int              overall_alpha);
Packit a4058c
GDK_PIXBUF_AVAILABLE_IN_ALL
Packit a4058c
void gdk_pixbuf_composite_color (const GdkPixbuf *src,
Packit a4058c
				 GdkPixbuf       *dest,
Packit a4058c
				 int              dest_x,
Packit a4058c
				 int              dest_y,
Packit a4058c
				 int              dest_width,
Packit a4058c
				 int              dest_height,
Packit a4058c
				 double           offset_x,
Packit a4058c
				 double           offset_y,
Packit a4058c
				 double           scale_x,
Packit a4058c
				 double           scale_y,
Packit a4058c
				 GdkInterpType    interp_type,
Packit a4058c
				 int              overall_alpha,
Packit a4058c
				 int              check_x,
Packit a4058c
				 int              check_y,
Packit a4058c
				 int              check_size,
Packit a4058c
				 guint32          color1,
Packit a4058c
				 guint32          color2);
Packit a4058c
Packit a4058c
GDK_PIXBUF_AVAILABLE_IN_ALL
Packit a4058c
GdkPixbuf *gdk_pixbuf_scale_simple           (const GdkPixbuf *src,
Packit a4058c
					      int              dest_width,
Packit a4058c
					      int              dest_height,
Packit a4058c
					      GdkInterpType    interp_type);
Packit a4058c
Packit a4058c
GDK_PIXBUF_AVAILABLE_IN_ALL
Packit a4058c
GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
Packit a4058c
					      int              dest_width,
Packit a4058c
					      int              dest_height,
Packit a4058c
					      GdkInterpType    interp_type,
Packit a4058c
					      int              overall_alpha,
Packit a4058c
					      int              check_size,
Packit a4058c
					      guint32          color1,
Packit a4058c
					      guint32          color2);
Packit a4058c
Packit a4058c
GDK_PIXBUF_AVAILABLE_IN_2_6
Packit a4058c
GdkPixbuf *gdk_pixbuf_rotate_simple          (const GdkPixbuf   *src,
Packit a4058c
				              GdkPixbufRotation  angle);
Packit a4058c
GDK_PIXBUF_AVAILABLE_IN_2_6
Packit a4058c
GdkPixbuf *gdk_pixbuf_flip                   (const GdkPixbuf   *src,
Packit a4058c
				              gboolean           horizontal);
Packit a4058c
				     
Packit a4058c
G_END_DECLS
Packit a4058c
Packit a4058c
Packit a4058c
#endif  /* GDK_PIXBUF_TRANSFORM_H */