File: //usr/local/ssl/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-scaling.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Scaling</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="The gdk-pixbuf Library">
<link rel="up" href="rn01.html" title="API Reference">
<link rel="prev" href="gdk-pixbuf-inline.html" title="Inline data">
<link rel="next" href="gdk-pixbuf-gdk-pixbuf-rendering.html" title="Rendering">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="reference" href="rn01.html" title="API Reference">
<link rel="reference" href="rn02.html" title="Tools Reference">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="appendix" href="apa.html" title="Appendix A. Porting applications from Imlib to gdk-pixbuf">
<link rel="appendix" href="license.html" title="Appendix B. License">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-pixbuf-inline.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">The <span class="application">gdk-pixbuf</span> Library</th>
<td><a accesskey="n" href="gdk-pixbuf-gdk-pixbuf-rendering.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3110735" class="shortcut">Top</a>
 | 
<a href="#id3111291" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-pixbuf-scaling"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id3110735"></a><span class="refentrytitle">Scaling</span>
</h2>
<p>Scaling — Scaling pixbufs and scaling and compositing pixbufs</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <gdk-pixbuf/gdk-pixbuf.h>
enum <a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a>;
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale-simple">gdk_pixbuf_scale_simple</a> (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
int dest_width,
int dest_height,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type);
void <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale">gdk_pixbuf_scale</a> (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest,
int dest_x,
int dest_y,
int dest_width,
int dest_height,
double offset_x,
double offset_y,
double scale_x,
double scale_y,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type);
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite-color-simple">gdk_pixbuf_composite_color_simple</a>
(const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
int dest_width,
int dest_height,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type,
int overall_alpha,
int check_size,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> color1,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> color2);
void <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite">gdk_pixbuf_composite</a> (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest,
int dest_x,
int dest_y,
int dest_width,
int dest_height,
double offset_x,
double offset_y,
double scale_x,
double scale_y,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type,
int overall_alpha);
void <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite-color">gdk_pixbuf_composite_color</a> (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest,
int dest_x,
int dest_y,
int dest_width,
int dest_height,
double offset_x,
double offset_y,
double scale_x,
double scale_y,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type,
int overall_alpha,
int check_x,
int check_y,
int check_size,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> color1,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> color2);
enum <a href="gdk-pixbuf-scaling.html#GdkPixbufRotation">GdkPixbufRotation</a>;
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-rotate-simple">gdk_pixbuf_rotate_simple</a> (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a href="gdk-pixbuf-scaling.html#GdkPixbufRotation">GdkPixbufRotation</a> angle);
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-flip">gdk_pixbuf_flip</a> (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> horizontal);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3111291"></a><h2>Description</h2>
<p>
The <span class="application">gdk-pixbuf</span> contains functions to scale pixbufs, to scale
pixbufs and composite against an existing image, and to scale
pixbufs and composite against a solid color or checkerboard.
Compositing a checkerboard is a common way to show an image with
an alpha channel in image-viewing and editing software.
</p>
<p>
Since the full-featured functions (<a href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale"><code class="function">gdk_pixbuf_scale()</code></a>,
<a href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite"><code class="function">gdk_pixbuf_composite()</code></a>, and <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite-color"><code class="function">gdk_pixbuf_composite_color()</code></a>) are
rather complex to use and have many arguments, two simple
convenience functions are provided, <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale-simple"><code class="function">gdk_pixbuf_scale_simple()</code></a> and
<a href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite-color-simple"><code class="function">gdk_pixbuf_composite_color_simple()</code></a> which create a new pixbuf of a
given size, scale an original image to fit, and then return the
new pixbuf.
</p>
<p>
The following example demonstrates handling an expose event by
rendering the appropriate area of a source image (which is scaled
to fit the widget) onto the widget's window. The source image is
rendered against a checkerboard, which provides a visual
representation of the alpha channel if the image has one. If the
image doesn't have an alpha channel, calling
<a href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite-color"><code class="function">gdk_pixbuf_composite_color()</code></a> function has exactly the same effect
as calling <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale"><code class="function">gdk_pixbuf_scale()</code></a>.
</p>
<div class="example">
<a name="id3111418"></a><p class="title"><b>Example 2. Handling an expose event.</b></p>
<pre class="programlisting">
gboolean
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
GdkPixbuf *dest;
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
gdk_pixbuf_composite_color (pixbuf, dest,
0, 0, event->area.width, event->area.height,
-event->area.x, -event->area.y,
(double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf),
(double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf),
GDK_INTERP_BILINEAR, 255,
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
gdk_pixbuf_render_to_drawable (dest, widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
0, 0, event->area.x, event->area.y,
event->area.width, event->area.height,
GDK_RGB_DITHER_NORMAL, event->area.x, event->area.y);
gdk_pixbuf_unref (dest);
return TRUE;
}
</pre>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3111450"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3111460"></a><h3>
<a name="GdkInterpType"></a>enum GdkInterpType</h3>
<a class="indexterm" name="id3111472"></a><pre class="programlisting">typedef enum {
GDK_INTERP_NEAREST,
GDK_INTERP_TILES,
GDK_INTERP_BILINEAR,
GDK_INTERP_HYPER
} GdkInterpType;
</pre>
<p>
This enumeration describes the different interpolation modes that
can be used with the scaling functions. <em class="parameter"><code>GDK_INTERP_NEAREST</code></em> is
the fastest scaling method, but has horrible quality when
scaling down. <em class="parameter"><code>GDK_INTERP_BILINEAR</code></em> is the best choice if you
aren't sure what to choose, it has a good speed/quality balance.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Cubic filtering is missing from the list; hyperbolic
interpolation is just as fast and results in higher quality.
</p>
</div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="GDK-INTERP-NEAREST:CAPS"></a><code class="literal">GDK_INTERP_NEAREST</code></span></td>
<td>Nearest neighbor sampling; this is the fastest
and lowest quality mode. Quality is normally unacceptable when scaling
down, but may be OK when scaling up.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GDK-INTERP-TILES:CAPS"></a><code class="literal">GDK_INTERP_TILES</code></span></td>
<td>This is an accurate simulation of the PostScript
image operator without any interpolation enabled. Each pixel is
rendered as a tiny parallelogram of solid color, the edges of which
are implemented with antialiasing. It resembles nearest neighbor for
enlargement, and bilinear for reduction.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GDK-INTERP-BILINEAR:CAPS"></a><code class="literal">GDK_INTERP_BILINEAR</code></span></td>
<td>Best quality/speed balance; use this mode by
default. Bilinear interpolation. For enlargement, it is
equivalent to point-sampling the ideal bilinear-interpolated image.
For reduction, it is equivalent to laying down small tiles and
integrating over the coverage area.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GDK-INTERP-HYPER:CAPS"></a><code class="literal">GDK_INTERP_HYPER</code></span></td>
<td>This is the slowest and highest quality
reconstruction function. It is derived from the hyperbolic filters in
Wolberg's "Digital Image Warping", and is formally defined as the
hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
image (the filter is designed to be idempotent for 1:1 pixel mapping).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3111625"></a><h3>
<a name="gdk-pixbuf-scale-simple"></a>gdk_pixbuf_scale_simple ()</h3>
<a class="indexterm" name="id3111637"></a><pre class="programlisting"><a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* gdk_pixbuf_scale_simple (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
int dest_width,
int dest_height,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type);</pre>
<p>
Create a new <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> containing a copy of <em class="parameter"><code>src</code></em> scaled to
<em class="parameter"><code>dest_width</code></em> x <em class="parameter"><code>dest_height</code></em>. Leaves <em class="parameter"><code>src</code></em> unaffected. <em class="parameter"><code>interp_type</code></em>
should be <a href="gdk-pixbuf-scaling.html#GDK-INTERP-NEAREST:CAPS"><span class="type">GDK_INTERP_NEAREST</span></a> if you want maximum speed (but when
scaling down <a href="gdk-pixbuf-scaling.html#GDK-INTERP-NEAREST:CAPS"><span class="type">GDK_INTERP_NEAREST</span></a> is usually unusably ugly). The
default <em class="parameter"><code>interp_type</code></em> should be <a href="gdk-pixbuf-scaling.html#GDK-INTERP-BILINEAR:CAPS"><span class="type">GDK_INTERP_BILINEAR</span></a> which offers
reasonable quality and speed.
</p>
<p>
You can scale a sub-portion of <em class="parameter"><code>src</code></em> by creating a sub-pixbuf
pointing into <em class="parameter"><code>src</code></em>; see <a href="gdk-pixbuf-creating.html#gdk-pixbuf-new-subpixbuf"><code class="function">gdk_pixbuf_new_subpixbuf()</code></a>.
</p>
<p>
For more complicated scaling/compositing see <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale"><code class="function">gdk_pixbuf_scale()</code></a>
and <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite"><code class="function">gdk_pixbuf_composite()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_width</code></em> :</span></td>
<td> the width of destination image
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_height</code></em> :</span></td>
<td> the height of destination image
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>interp_type</code></em> :</span></td>
<td> the interpolation type for the transformation.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the new <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if not enough memory could be
allocated for it.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3111914"></a><h3>
<a name="gdk-pixbuf-scale"></a>gdk_pixbuf_scale ()</h3>
<a class="indexterm" name="id3111927"></a><pre class="programlisting">void gdk_pixbuf_scale (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest,
int dest_x,
int dest_y,
int dest_width,
int dest_height,
double offset_x,
double offset_y,
double scale_x,
double scale_y,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type);</pre>
<p>
Creates a transformation of the source image <em class="parameter"><code>src</code></em> by scaling by
<em class="parameter"><code>scale_x</code></em> and <em class="parameter"><code>scale_y</code></em> then translating by <em class="parameter"><code>offset_x</code></em> and <em class="parameter"><code>offset_y</code></em>,
then renders the rectangle (<em class="parameter"><code>dest_x</code></em>, <em class="parameter"><code>dest_y</code></em>, <em class="parameter"><code>dest_width</code></em>,
<em class="parameter"><code>dest_height</code></em>) of the resulting image onto the destination image
replacing the previous contents.
</p>
<p>
Try to use <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale-simple"><code class="function">gdk_pixbuf_scale_simple()</code></a> first, this function is
the industrial-strength power tool you can fall back to if
<a href="gdk-pixbuf-scaling.html#gdk-pixbuf-scale-simple"><code class="function">gdk_pixbuf_scale_simple()</code></a> isn't powerful enough.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest</code></em> :</span></td>
<td> the <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> into which to render the results
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_x</code></em> :</span></td>
<td> the left coordinate for region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_y</code></em> :</span></td>
<td> the top coordinate for region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_width</code></em> :</span></td>
<td> the width of the region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_height</code></em> :</span></td>
<td> the height of the region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset_x</code></em> :</span></td>
<td> the offset in the X direction (currently rounded to an integer)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset_y</code></em> :</span></td>
<td> the offset in the Y direction (currently rounded to an integer)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>scale_x</code></em> :</span></td>
<td> the scale factor in the X direction
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>scale_y</code></em> :</span></td>
<td> the scale factor in the Y direction
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>interp_type</code></em> :</span></td>
<td> the interpolation type for the transformation.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3112294"></a><h3>
<a name="gdk-pixbuf-composite-color-simple"></a>gdk_pixbuf_composite_color_simple ()</h3>
<a class="indexterm" name="id3112308"></a><pre class="programlisting"><a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* gdk_pixbuf_composite_color_simple
(const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
int dest_width,
int dest_height,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type,
int overall_alpha,
int check_size,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> color1,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> color2);</pre>
<p>
Creates a new <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> by scaling <em class="parameter"><code>src</code></em> to <em class="parameter"><code>dest_width</code></em> x
<em class="parameter"><code>dest_height</code></em> and compositing the result with a checkboard of colors
<em class="parameter"><code>color1</code></em> and <em class="parameter"><code>color2</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_width</code></em> :</span></td>
<td> the width of destination image
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_height</code></em> :</span></td>
<td> the height of destination image
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>interp_type</code></em> :</span></td>
<td> the interpolation type for the transformation.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>overall_alpha</code></em> :</span></td>
<td> overall alpha for source image (0..255)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>check_size</code></em> :</span></td>
<td> the size of checks in the checkboard (must be a power of two)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color1</code></em> :</span></td>
<td> the color of check at upper left
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color2</code></em> :</span></td>
<td> the color of the other check
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the new <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if not enough memory could be
allocated for it.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3112586"></a><h3>
<a name="gdk-pixbuf-composite"></a>gdk_pixbuf_composite ()</h3>
<a class="indexterm" name="id3112599"></a><pre class="programlisting">void gdk_pixbuf_composite (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest,
int dest_x,
int dest_y,
int dest_width,
int dest_height,
double offset_x,
double offset_y,
double scale_x,
double scale_y,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type,
int overall_alpha);</pre>
<p>
Creates a transformation of the source image <em class="parameter"><code>src</code></em> by scaling by
<em class="parameter"><code>scale_x</code></em> and <em class="parameter"><code>scale_y</code></em> then translating by <em class="parameter"><code>offset_x</code></em> and <em class="parameter"><code>offset_y</code></em>.
This gives an image in the coordinates of the destination pixbuf.
The rectangle (<em class="parameter"><code>dest_x</code></em>, <em class="parameter"><code>dest_y</code></em>, <em class="parameter"><code>dest_width</code></em>, <em class="parameter"><code>dest_height</code></em>)
is then composited onto the corresponding rectangle of the
original destination image.
</p>
<p>
When the destination rectangle contains parts not in the source
image, the data at the edges of the source image is replicated
to infinity.
</p>
<p>
</p>
<div class="figure">
<a name="pixbuf-composite-diagram"></a><p class="title"><b>Figure 1. Compositing of pixbufs</b></p>
<div><img src="composite.png" alt="Compositing of pixbufs"></div>
</div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest</code></em> :</span></td>
<td> the <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> into which to render the results
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_x</code></em> :</span></td>
<td> the left coordinate for region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_y</code></em> :</span></td>
<td> the top coordinate for region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_width</code></em> :</span></td>
<td> the width of the region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_height</code></em> :</span></td>
<td> the height of the region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset_x</code></em> :</span></td>
<td> the offset in the X direction (currently rounded to an integer)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset_y</code></em> :</span></td>
<td> the offset in the Y direction (currently rounded to an integer)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>scale_x</code></em> :</span></td>
<td> the scale factor in the X direction
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>scale_y</code></em> :</span></td>
<td> the scale factor in the Y direction
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>interp_type</code></em> :</span></td>
<td> the interpolation type for the transformation.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>overall_alpha</code></em> :</span></td>
<td> overall alpha for source image (0..255)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3112988"></a><h3>
<a name="gdk-pixbuf-composite-color"></a>gdk_pixbuf_composite_color ()</h3>
<a class="indexterm" name="id3113002"></a><pre class="programlisting">void gdk_pixbuf_composite_color (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest,
int dest_x,
int dest_y,
int dest_width,
int dest_height,
double offset_x,
double offset_y,
double scale_x,
double scale_y,
<a href="gdk-pixbuf-scaling.html#GdkInterpType">GdkInterpType</a> interp_type,
int overall_alpha,
int check_x,
int check_y,
int check_size,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> color1,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> color2);</pre>
<p>
Creates a transformation of the source image <em class="parameter"><code>src</code></em> by scaling by
<em class="parameter"><code>scale_x</code></em> and <em class="parameter"><code>scale_y</code></em> then translating by <em class="parameter"><code>offset_x</code></em> and <em class="parameter"><code>offset_y</code></em>,
then composites the rectangle (<em class="parameter"><code>dest_x</code></em> ,<em class="parameter"><code>dest_y</code></em>, <em class="parameter"><code>dest_width</code></em>,
<em class="parameter"><code>dest_height</code></em>) of the resulting image with a checkboard of the
colors <em class="parameter"><code>color1</code></em> and <em class="parameter"><code>color2</code></em> and renders it onto the destination
image.
</p>
<p>
See <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-composite-color-simple"><code class="function">gdk_pixbuf_composite_color_simple()</code></a> for a simpler variant of this
function suitable for many tasks.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest</code></em> :</span></td>
<td> the <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> into which to render the results
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_x</code></em> :</span></td>
<td> the left coordinate for region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_y</code></em> :</span></td>
<td> the top coordinate for region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_width</code></em> :</span></td>
<td> the width of the region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dest_height</code></em> :</span></td>
<td> the height of the region to render
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset_x</code></em> :</span></td>
<td> the offset in the X direction (currently rounded to an integer)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset_y</code></em> :</span></td>
<td> the offset in the Y direction (currently rounded to an integer)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>scale_x</code></em> :</span></td>
<td> the scale factor in the X direction
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>scale_y</code></em> :</span></td>
<td> the scale factor in the Y direction
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>interp_type</code></em> :</span></td>
<td> the interpolation type for the transformation.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>overall_alpha</code></em> :</span></td>
<td> overall alpha for source image (0..255)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>check_x</code></em> :</span></td>
<td> the X offset for the checkboard (origin of checkboard is at -<em class="parameter"><code>check_x</code></em>, -<em class="parameter"><code>check_y</code></em>)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>check_y</code></em> :</span></td>
<td> the Y offset for the checkboard
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>check_size</code></em> :</span></td>
<td> the size of checks in the checkboard (must be a power of two)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color1</code></em> :</span></td>
<td> the color of check at upper left
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color2</code></em> :</span></td>
<td> the color of the other check
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3113512"></a><h3>
<a name="GdkPixbufRotation"></a>enum GdkPixbufRotation</h3>
<a class="indexterm" name="id3113525"></a><pre class="programlisting">typedef enum {
GDK_PIXBUF_ROTATE_NONE = 0,
GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE = 90,
GDK_PIXBUF_ROTATE_UPSIDEDOWN = 180,
GDK_PIXBUF_ROTATE_CLOCKWISE = 270
} GdkPixbufRotation;
</pre>
<p>
The possible rotations which can be passed to <a href="gdk-pixbuf-scaling.html#gdk-pixbuf-rotate-simple"><code class="function">gdk_pixbuf_rotate_simple()</code></a>.
To make them easier to use, their numerical values are the actual degrees.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="GDK-PIXBUF-ROTATE-NONE:CAPS"></a><code class="literal">GDK_PIXBUF_ROTATE_NONE</code></span></td>
<td>No rotation.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GDK-PIXBUF-ROTATE-COUNTERCLOCKWISE:CAPS"></a><code class="literal">GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE</code></span></td>
<td>Rotate by 90 degrees.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GDK-PIXBUF-ROTATE-UPSIDEDOWN:CAPS"></a><code class="literal">GDK_PIXBUF_ROTATE_UPSIDEDOWN</code></span></td>
<td>Rotate by 180 degrees.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GDK-PIXBUF-ROTATE-CLOCKWISE:CAPS"></a><code class="literal">GDK_PIXBUF_ROTATE_CLOCKWISE</code></span></td>
<td>Rotate by 270 degrees.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3113653"></a><h3>
<a name="gdk-pixbuf-rotate-simple"></a>gdk_pixbuf_rotate_simple ()</h3>
<a class="indexterm" name="id3113668"></a><pre class="programlisting"><a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* gdk_pixbuf_rotate_simple (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a href="gdk-pixbuf-scaling.html#GdkPixbufRotation">GdkPixbufRotation</a> angle);</pre>
<p>
Rotates a pixbuf by a multiple of 90 degrees, and returns the
result in a new pixbuf.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>angle</code></em> :</span></td>
<td> the angle to rotate by
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new pixbuf
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3113763"></a><h3>
<a name="gdk-pixbuf-flip"></a>gdk_pixbuf_flip ()</h3>
<a class="indexterm" name="id3113778"></a><pre class="programlisting"><a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* gdk_pixbuf_flip (const <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *src,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> horizontal);</pre>
<p>
Flips a pixbuf horizontally or vertically and returns the
result in a new pixbuf.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>horizontal</code></em> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> to flip horizontally, <a
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a> to flip vertically
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new pixbuf.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.6
</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3113894"></a><h2>See Also</h2>
<p>
<a
href="../gdk/gdk-GdkRGB.html"
>GdkRGB</a>.
</p>
</div>
</div>
</body>
</html>