Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Xlib Rendering: GDK-PixBuf Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GDK-PixBuf Reference Manual">
<link rel="up" href="rn01.html" title="API Reference">
<link rel="prev" href="gdk-pixbuf-gdk-pixbuf-Xlib-initialization.html" title="gdk-pixbuf Xlib initialization">
<link rel="next" href="gdk-pixbuf-X-Drawables-to-Pixbufs.html" title="X Drawables to Pixbufs">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</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="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#gdk-pixbuf-Xlib-Rendering.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gdk-pixbuf-gdk-pixbuf-Xlib-initialization.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gdk-pixbuf-X-Drawables-to-Pixbufs.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gdk-pixbuf-Xlib-Rendering"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-pixbuf-Xlib-Rendering.top_of_page"></a>Xlib Rendering</span></h2>
<p>Xlib Rendering — Rendering a pixbuf to an X drawable.</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gdk-pixbuf-Xlib-Rendering.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk-pixbuf-Xlib-Rendering.html#gdk-pixbuf-xlib-render-threshold-alpha" title="gdk_pixbuf_xlib_render_threshold_alpha ()">gdk_pixbuf_xlib_render_threshold_alpha</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk-pixbuf-Xlib-Rendering.html#gdk-pixbuf-xlib-render-to-drawable" title="gdk_pixbuf_xlib_render_to_drawable ()">gdk_pixbuf_xlib_render_to_drawable</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk-pixbuf-Xlib-Rendering.html#gdk-pixbuf-xlib-render-to-drawable-alpha" title="gdk_pixbuf_xlib_render_to_drawable_alpha ()">gdk_pixbuf_xlib_render_to_drawable_alpha</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk-pixbuf-Xlib-Rendering.html#gdk-pixbuf-xlib-render-pixmap-and-mask" title="gdk_pixbuf_xlib_render_pixmap_and_mask ()">gdk_pixbuf_xlib_render_pixmap_and_mask</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-Xlib-Rendering.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gdk-pixbuf/gdk-pixbuf.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-Xlib-Rendering.description"></a><h2>Description</h2>
<p>The &amp;gdk-pixbuf; Xlib library provides several convenience
functions to render pixbufs to X drawables.  It uses XlibRGB to
render the image data.</p>
<p>These functions are analogous to those for the GDK version of
&amp;gdk-pixbuf;.</p>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-Xlib-Rendering.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gdk-pixbuf-xlib-render-threshold-alpha"></a><h3>gdk_pixbuf_xlib_render_threshold_alpha ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_pixbuf_xlib_render_threshold_alpha
                               (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>,
                                <em class="parameter"><code><span class="type">Pixmap</span> bitmap</code></em>,
                                <em class="parameter"><code><span class="type">int</span> src_x</code></em>,
                                <em class="parameter"><code><span class="type">int</span> src_y</code></em>,
                                <em class="parameter"><code><span class="type">int</span> dest_x</code></em>,
                                <em class="parameter"><code><span class="type">int</span> dest_y</code></em>,
                                <em class="parameter"><code><span class="type">int</span> width</code></em>,
                                <em class="parameter"><code><span class="type">int</span> height</code></em>,
                                <em class="parameter"><code><span class="type">int</span> alpha_threshold</code></em>);</pre>
<p>Takes the opacity values in a rectangular portion of a pixbuf and thresholds
them to produce a bi-level alpha mask that can be used as a clipping mask for
a drawable.</p>
<div class="refsect3">
<a name="gdk-pixbuf-xlib-render-threshold-alpha.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pixbuf</p></td>
<td class="parameter_description"><p>A pixbuf.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>bitmap</p></td>
<td class="parameter_description"><p>Bitmap where the bilevel mask will be painted to.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_x</p></td>
<td class="parameter_description"><p>Source X coordinate.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_y</p></td>
<td class="parameter_description"><p>source Y coordinate.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest_x</p></td>
<td class="parameter_description"><p>Destination X coordinate.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest_y</p></td>
<td class="parameter_description"><p>Destination Y coordinate.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>width</p></td>
<td class="parameter_description"><p>Width of region to threshold.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>height</p></td>
<td class="parameter_description"><p>Height of region to threshold.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>alpha_threshold</p></td>
<td class="parameter_description"><p>Opacity values below this will be painted as zero; all
other values will be painted as one.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-xlib-render-to-drawable"></a><h3>gdk_pixbuf_xlib_render_to_drawable ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_pixbuf_xlib_render_to_drawable (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>,
                                    <em class="parameter"><code><span class="type">Drawable</span> drawable</code></em>,
                                    <em class="parameter"><code><span class="type">GC</span> gc</code></em>,
                                    <em class="parameter"><code><span class="type">int</span> src_x</code></em>,
                                    <em class="parameter"><code><span class="type">int</span> src_y</code></em>,
                                    <em class="parameter"><code><span class="type">int</span> dest_x</code></em>,
                                    <em class="parameter"><code><span class="type">int</span> dest_y</code></em>,
                                    <em class="parameter"><code><span class="type">int</span> width</code></em>,
                                    <em class="parameter"><code><span class="type">int</span> height</code></em>,
                                    <em class="parameter"><code><a class="link" href="gdk-pixbuf-XlibRGB.html#XlibRgbDither" title="enum XlibRgbDither"><span class="type">XlibRgbDither</span></a> dither</code></em>,
                                    <em class="parameter"><code><span class="type">int</span> x_dither</code></em>,
                                    <em class="parameter"><code><span class="type">int</span> y_dither</code></em>);</pre>
<p>Renders a rectangular portion of a pixbuf to a drawable while using the
specified GC.  This is done using XlibRGB, so the specified drawable must
have the XlibRGB visual and colormap.  Note that this function will ignore
the opacity information for images with an alpha channel; the GC must already
have the clipping mask set if you want transparent regions to show through.</p>
<p>For an explanation of dither offsets, see the XlibRGB documentation.  In
brief, the dither offset is important when re-rendering partial regions of an
image to a rendered version of the full image, or for when the offsets to a
base position change, as in scrolling.  The dither matrix has to be shifted
for consistent visual results.  If you do not have any of these cases, the
dither offsets can be both zero.</p>
<div class="refsect3">
<a name="gdk-pixbuf-xlib-render-to-drawable.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pixbuf</p></td>
<td class="parameter_description"><p>A pixbuf.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>drawable</p></td>
<td class="parameter_description"><p>Destination drawable.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>gc</p></td>
<td class="parameter_description"><p>GC used for rendering.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_x</p></td>
<td class="parameter_description"><p>Source X coordinate within pixbuf.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_y</p></td>
<td class="parameter_description"><p>Source Y coordinate within pixbuf.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest_x</p></td>
<td class="parameter_description"><p>Destination X coordinate within drawable.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest_y</p></td>
<td class="parameter_description"><p>Destination Y coordinate within drawable.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>width</p></td>
<td class="parameter_description"><p>Width of region to render, in pixels.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>height</p></td>
<td class="parameter_description"><p>Height of region to render, in pixels.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dither</p></td>
<td class="parameter_description"><p>Dithering mode for XlibRGB.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>x_dither</p></td>
<td class="parameter_description"><p>X offset for dither.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>y_dither</p></td>
<td class="parameter_description"><p>Y offset for dither.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-xlib-render-to-drawable-alpha"></a><h3>gdk_pixbuf_xlib_render_to_drawable_alpha ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_pixbuf_xlib_render_to_drawable_alpha
                               (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>,
                                <em class="parameter"><code><span class="type">Drawable</span> drawable</code></em>,
                                <em class="parameter"><code><span class="type">int</span> src_x</code></em>,
                                <em class="parameter"><code><span class="type">int</span> src_y</code></em>,
                                <em class="parameter"><code><span class="type">int</span> dest_x</code></em>,
                                <em class="parameter"><code><span class="type">int</span> dest_y</code></em>,
                                <em class="parameter"><code><span class="type">int</span> width</code></em>,
                                <em class="parameter"><code><span class="type">int</span> height</code></em>,
                                <em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbufAlphaMode" title="enum GdkPixbufAlphaMode"><span class="type">GdkPixbufAlphaMode</span></a> alpha_mode</code></em>,
                                <em class="parameter"><code><span class="type">int</span> alpha_threshold</code></em>,
                                <em class="parameter"><code><a class="link" href="gdk-pixbuf-XlibRGB.html#XlibRgbDither" title="enum XlibRgbDither"><span class="type">XlibRgbDither</span></a> dither</code></em>,
                                <em class="parameter"><code><span class="type">int</span> x_dither</code></em>,
                                <em class="parameter"><code><span class="type">int</span> y_dither</code></em>);</pre>
<p>Renders a rectangular portion of a pixbuf to a drawable.  This is done using
XlibRGB, so the specified drawable must have the XlibRGB visual and colormap.</p>
<p>When used with <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ALPHA-BILEVEL:CAPS"><span class="type">GDK_PIXBUF_ALPHA_BILEVEL</span></a>, this function has to create a bitmap
out of the thresholded alpha channel of the image and, it has to set this
bitmap as the clipping mask for the GC used for drawing.  This can be a
significant performance penalty depending on the size and the complexity of
the alpha channel of the image.  If performance is crucial, consider handling
the alpha channel yourself (possibly by caching it in your application) and
using <a class="link" href="gdk-pixbuf-Xlib-Rendering.html#gdk-pixbuf-xlib-render-to-drawable" title="gdk_pixbuf_xlib_render_to_drawable ()"><code class="function">gdk_pixbuf_xlib_render_to_drawable()</code></a> or GdkRGB directly instead.</p>
<div class="refsect3">
<a name="gdk-pixbuf-xlib-render-to-drawable-alpha.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pixbuf</p></td>
<td class="parameter_description"><p>A pixbuf.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>drawable</p></td>
<td class="parameter_description"><p>Destination drawable.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_x</p></td>
<td class="parameter_description"><p>Source X coordinate within pixbuf.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_y</p></td>
<td class="parameter_description"><p>Source Y coordinates within pixbuf.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest_x</p></td>
<td class="parameter_description"><p>Destination X coordinate within drawable.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest_y</p></td>
<td class="parameter_description"><p>Destination Y coordinate within drawable.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>width</p></td>
<td class="parameter_description"><p>Width of region to render, in pixels.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>height</p></td>
<td class="parameter_description"><p>Height of region to render, in pixels.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>alpha_mode</p></td>
<td class="parameter_description"><p>If the image does not have opacity information, this is ignored.
Otherwise, specifies how to handle transparency when rendering.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>alpha_threshold</p></td>
<td class="parameter_description"><p>If the image does have opacity information and <em class="parameter"><code>alpha_mode</code></em>
is GDK_PIXBUF_ALPHA_BILEVEL, specifies the threshold value for opacity
values.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dither</p></td>
<td class="parameter_description"><p>Dithering mode for XlibRGB.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>x_dither</p></td>
<td class="parameter_description"><p>X offset for dither.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>y_dither</p></td>
<td class="parameter_description"><p>Y offset for dither.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-xlib-render-pixmap-and-mask"></a><h3>gdk_pixbuf_xlib_render_pixmap_and_mask ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_pixbuf_xlib_render_pixmap_and_mask
                               (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>,
                                <em class="parameter"><code><span class="type">Pixmap</span> *pixmap_return</code></em>,
                                <em class="parameter"><code><span class="type">Pixmap</span> *mask_return</code></em>,
                                <em class="parameter"><code><span class="type">int</span> alpha_threshold</code></em>);</pre>
<p>Creates a pixmap and a mask bitmap which are returned in the <em class="parameter"><code>pixmap_return</code></em>

and <em class="parameter"><code>mask_return</code></em>
 arguments, respectively, and renders a pixbuf and its
corresponding tresholded alpha mask to them.  This is merely a convenience
function; applications that need to render pixbufs with dither offsets or to
given drawables should use <a class="link" href="gdk-pixbuf-Xlib-Rendering.html#gdk-pixbuf-xlib-render-to-drawable-alpha" title="gdk_pixbuf_xlib_render_to_drawable_alpha ()"><code class="function">gdk_pixbuf_xlib_render_to_drawable_alpha()</code></a> or
<a class="link" href="gdk-pixbuf-Xlib-Rendering.html#gdk-pixbuf-xlib-render-to-drawable" title="gdk_pixbuf_xlib_render_to_drawable ()"><code class="function">gdk_pixbuf_xlib_render_to_drawable()</code></a>, and
<a class="link" href="gdk-pixbuf-Xlib-Rendering.html#gdk-pixbuf-xlib-render-threshold-alpha" title="gdk_pixbuf_xlib_render_threshold_alpha ()"><code class="function">gdk_pixbuf_xlib_render_threshold_alpha()</code></a>.</p>
<p>If the pixbuf does not have an alpha channel, then *<em class="parameter"><code>mask_return</code></em>
 will be set
to None.</p>
<div class="refsect3">
<a name="gdk-pixbuf-xlib-render-pixmap-and-mask.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pixbuf</p></td>
<td class="parameter_description"><p>A pixbuf.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pixmap_return</p></td>
<td class="parameter_description"><p>Return value for the created pixmap.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>mask_return</p></td>
<td class="parameter_description"><p>Return value for the created mask.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>alpha_threshold</p></td>
<td class="parameter_description"><p>Threshold value for opacity values.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-Xlib-Rendering.other_details"></a><h2>Types and Values</h2>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>