📄 gdk-images.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>Images</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-GdkRGB.html" title="GdkRGB"><link rel="next" href="gdk-Pixbufs.html" title="Pixbufs"><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-GdkRGB.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-Pixbufs.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="#id3134333" class="shortcut">Top</a>  |  <a href="#id3134702" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="gdk-Images"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3134333"></a><span class="refentrytitle">Images</span></h2><p>Images — A client-side area for bit-mapped graphics</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include <gdk/gdk.h> <a class="link" href="gdk-Images.html#GdkImage">GdkImage</a>;<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a>* <a class="link" href="gdk-Images.html#gdk-image-new">gdk_image_new</a> (<a class="link" href="gdk-Images.html#GdkImageType">GdkImageType</a> type, <a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a> *visual, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> width, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> height);enum <a class="link" href="gdk-Images.html#GdkImageType">GdkImageType</a>;<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a>* <a class="link" href="gdk-Images.html#gdk-image-new-bitmap">gdk_image_new_bitmap</a> (<a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a> *visual, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> width, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> height);<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a>* <a class="link" href="gdk-Images.html#gdk-image-get">gdk_image_get</a> (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> width, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> height);<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a>* <a class="link" href="gdk-Images.html#gdk-image-ref">gdk_image_ref</a> (<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a> *image);void <a class="link" href="gdk-Images.html#gdk-image-unref">gdk_image_unref</a> (<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a> *image);#define <a class="link" href="gdk-Images.html#gdk-image-destroy">gdk_image_destroy</a><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* <a class="link" href="gdk-Images.html#gdk-image-get-colormap">gdk_image_get_colormap</a> (<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a> *image);void <a class="link" href="gdk-Images.html#gdk-image-set-colormap">gdk_image_set_colormap</a> (<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a> *image, <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap);void <a class="link" href="gdk-Images.html#gdk-image-put-pixel">gdk_image_put_pixel</a> (<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a> *image, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> pixel);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> <a class="link" href="gdk-Images.html#gdk-image-get-pixel">gdk_image_get_pixel</a> (<a class="link" href="gdk-Images.html#GdkImage">GdkImage</a> *image, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y);</pre></div><div class="refsect1" lang="en"><a name="id3134702"></a><h2>Description</h2><p>The <a class="link" href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a> type represents an area for drawing graphics.It has now been superceded to a large extent by the much more flexible<a class="link" href="gdk-GdkRGB.html" title="GdkRGB">GdkRGB</a> functions.</p><p>To create an empty <a class="link" href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a> use <a class="link" href="gdk-Images.html#gdk-image-new"><code class="function">gdk_image_new()</code></a>.To create a <a class="link" href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a> from bitmap data use <a class="link" href="gdk-Images.html#gdk-image-new-bitmap"><code class="function">gdk_image_new_bitmap()</code></a>.To create an image from part of a <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> use <a class="link" href="gdk-Drawing-Primitives.html#gdk-drawable-get-image"><code class="function">gdk_drawable_get_image()</code></a>.</p><p>The image can be manipulated with <a class="link" href="gdk-Images.html#gdk-image-get-pixel"><code class="function">gdk_image_get_pixel()</code></a> and<a class="link" href="gdk-Images.html#gdk-image-put-pixel"><code class="function">gdk_image_put_pixel()</code></a>, or alternatively by changing the actual pixel data.Though manipulating the pixel data requires complicated code to cope withthe different formats that may be used.</p><p>To draw a <a class="link" href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a> in a <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> or <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap"><span class="type">GdkPixmap</span></a> use <a class="link" href="gdk-Drawing-Primitives.html#gdk-draw-image"><code class="function">gdk_draw_image()</code></a>.</p><p>To destroy a <a class="link" href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a> use <a class="link" href="gdk-Images.html#gdk-image-destroy"><code class="function">gdk_image_destroy()</code></a>.</p></div><div class="refsect1" lang="en"><a name="id3134883"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3134893"></a><h3><a name="GdkImage"></a>GdkImage</h3><a class="indexterm" name="id3134906"></a><pre class="programlisting">typedef struct { GObject parent_instance; GdkImageType type; /* read only. */ GdkVisual *visual; /* read only. visual used to create the image */ GdkByteOrder byte_order; /* read only. */ gint width; /* read only. */ gint height; /* read only. */ guint16 depth; /* read only. */ guint16 bpp; /* read only. bytes per pixel */ guint16 bpl; /* read only. bytes per line */ guint16 bits_per_pixel; /* read only. bits per pixel */ gpointer mem; GdkColormap *colormap; /* read only. */} GdkImage;</pre><p>The <a class="link" href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a> struct contains information on the image and the pixel data.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a> <em class="structfield"><code>parent_instance</code></em>;</span></p></td><td>the parent instance</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Images.html#GdkImageType">GdkImageType</a> <em class="structfield"><code>type</code></em>;</span></p></td><td>the type of the image.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a> *<em class="structfield"><code>visual</code></em>;</span></p></td><td>the visual.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Visuals.html#GdkByteOrder">GdkByteOrder</a> <em class="structfield"><code>byte_order</code></em>;</span></p></td><td>the byte order.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> <em class="structfield"><code>width</code></em>;</span></p></td><td>the width of the image in pixels.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> <em class="structfield"><code>height</code></em>;</span></p></td><td>the height of the image in pixels.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16">guint16</a> <em class="structfield"><code>depth</code></em>;</span></p></td><td>the depth of the image, i.e. the number of bits per pixel.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16">guint16</a> <em class="structfield"><code>bpp</code></em>;</span></p></td><td>the number of bytes per pixel.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16">guint16</a> <em class="structfield"><code>bpl</code></em>;</span></p></td><td>the number of bytes per line of the image.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16">guint16</a> <em class="structfield"><code>bits_per_pixel</code></em>;</span></p></td><td>the number of bits per pixel.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> <em class="structfield"><code>mem</code></em>;</span></p></td><td>the pixel data.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *<em class="structfield"><code>colormap</code></em>;</span></p></td><td>the <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a> associated with the image
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -