📄 gdk-pixbufs.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>Pixbufs</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GDK Reference Manual"><link rel="up" href="reference.html" title="API Reference"><link rel="prev" href="gdk-Images.html" title="Images"><link rel="next" href="gdk-Colormaps-and-Colors.html" title="Colormaps and Colors"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="reference" href="reference.html" title="API 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="index" href="ix07.html" title="Index of new symbols in 2.10"><link rel="index" href="ix08.html" title="Index of new symbols in 2.12"></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-Images.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="reference.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">GDK Reference Manual</th><td><a accesskey="n" href="gdk-Colormaps-and-Colors.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="#id3139334" class="shortcut">Top</a>  |  <a href="#id3139917" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="gdk-Pixbufs"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3139334"></a><span class="refentrytitle">Pixbufs</span></h2><p>Pixbufs — Functions for rendering pixbufs on drawables</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include <gdk/gdk.h>void <a class="link" href="gdk-Pixbufs.html#gdk-pixbuf-render-threshold-alpha">gdk_pixbuf_render_threshold_alpha</a> (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf, <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> *bitmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_threshold);void <a class="link" href="gdk-Pixbufs.html#gdk-pixbuf-render-to-drawable">gdk_pixbuf_render_to_drawable</a> (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf, <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable, <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, <a class="link" href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dither, int x_dither, int y_dither);void <a class="link" href="gdk-Pixbufs.html#gdk-pixbuf-render-to-drawable-alpha">gdk_pixbuf_render_to_drawable_alpha</a> (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf, <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, <ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbufAlphaMode">GdkPixbufAlphaMode</a> alpha_mode, int alpha_threshold, <a class="link" href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dither, int x_dither, int y_dither);void <a class="link" href="gdk-Pixbufs.html#gdk-pixbuf-render-pixmap-and-mask">gdk_pixbuf_render_pixmap_and_mask</a> (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf, <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> **pixmap_return, <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> **mask_return, int alpha_threshold);void <a class="link" href="gdk-Pixbufs.html#gdk-pixbuf-render-pixmap-and-mask-for-colormap">gdk_pixbuf_render_pixmap_and_mask_for_colormap</a> (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf, <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap, <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> **pixmap_return, <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> **mask_return, int alpha_threshold);<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* <a class="link" href="gdk-Pixbufs.html#gdk-pixbuf-get-from-drawable">gdk_pixbuf_get_from_drawable</a> (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest, <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *src, <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height);<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a>* <a class="link" href="gdk-Pixbufs.html#gdk-pixbuf-get-from-image">gdk_pixbuf_get_from_image</a> (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *dest, <a class="link" href="gdk-Images.html#GdkImage">GdkImage</a> *src, <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height);</pre></div><div class="refsect1" lang="en"><a name="id3139917"></a><h2>Description</h2><p>These functions allow to render pixbufs on drawables. Pixbufs areclient-side images. For details on how to create and manipulatepixbufs, see the <ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> API documentation.</p></div><div class="refsect1" lang="en"><a name="id3139942"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3139952"></a><h3><a name="gdk-pixbuf-render-threshold-alpha"></a>gdk_pixbuf_render_threshold_alpha ()</h3><a class="indexterm" name="id3139967"></a><pre class="programlisting">void gdk_pixbuf_render_threshold_alpha (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf, <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> *bitmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_threshold);</pre><p>Takes the opacity values in a rectangular portion of a pixbuf and thresholdsthem to produce a bi-level alpha mask that can be used as a clipping mask fora drawable.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td><td> A pixbuf.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>bitmap</code></em> :</span></p></td><td> Bitmap where the bilevel mask will be painted to.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>src_x</code></em> :</span></p></td><td> Source X coordinate.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>src_y</code></em> :</span></p></td><td> source Y coordinate.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>dest_x</code></em> :</span></p></td><td> Destination X coordinate.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>dest_y</code></em> :</span></p></td><td> Destination Y coordinate.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td><td> Width of region to threshold, or -1 to use pixbuf width</td></tr><tr><td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td><td> Height of region to threshold, or -1 to use pixbuf height</td></tr><tr><td><p><span class="term"><em class="parameter"><code>alpha_threshold</code></em> :</span></p></td><td> Opacity values below this will be painted as zero; allother values will be painted as one.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3140193"></a><h3><a name="gdk-pixbuf-render-to-drawable"></a>gdk_pixbuf_render_to_drawable ()</h3><a class="indexterm" name="id3140210"></a><pre class="programlisting">void gdk_pixbuf_render_to_drawable (<ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf, <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable, <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, <a class="link" href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dither, int x_dither, int y_dither);</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">gdk_pixbuf_render_to_drawable</code> has been deprecated since version 2.4 and should not be used in newly-written code. This function is obsolete. Use <a class="link" href="gdk-Drawing-Primitives.html#gdk-draw-pixbuf"><code class="function">gdk_draw_pixbuf()</code></a> instead.</p></div><p>Renders a rectangular portion of a pixbuf to a drawable while using thespecified GC. This is done using GdkRGB, so the specified drawable must havethe GdkRGB visual and colormap. Note that this function will ignore theopacity information for images with an alpha channel; the GC must alreadyhave the clipping mask set if you want transparent regions to show through.</p><p>For an explanation of dither offsets, see the GdkRGB documentation. Inbrief, the dither offset is important when re-rendering partial regions of animage to a rendered version of the full image, or for when the offsets to abase position change, as in scrolling. The dither matrix has to be shiftedfor consistent visual results. If you do not have any of these cases, thedither offsets can be both zero.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td><td> A pixbuf.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td><td> Destination drawable.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td><td> GC used for rendering.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -