⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdk-visuals.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Visuals</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-Colormaps-and-Colors.html" title="Colormaps and Colors"><link rel="next" href="gdk-Fonts.html" title="Fonts"><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-Colormaps-and-Colors.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-Fonts.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="#id3154279" class="shortcut">Top</a>                  &#160;|&#160;                  <a href="#id3154578" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="gdk-Visuals"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3154279"></a><span class="refentrytitle">Visuals</span></h2><p>Visuals &#8212; Low-level display hardware information</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include &lt;gdk/gdk.h&gt;                    <a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a>;enum                <a class="link" href="gdk-Visuals.html#GdkVisualType">GdkVisualType</a>;enum                <a class="link" href="gdk-Visuals.html#GdkByteOrder">GdkByteOrder</a>;void                <a class="link" href="gdk-Visuals.html#gdk-query-depths">gdk_query_depths</a>                    (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> **depths,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> *count);void                <a class="link" href="gdk-Visuals.html#gdk-query-visual-types">gdk_query_visual_types</a>              (<a class="link" href="gdk-Visuals.html#GdkVisualType">GdkVisualType</a> **visual_types,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> *count);<ahref="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList">GList</a>*              <a class="link" href="gdk-Visuals.html#gdk-list-visuals">gdk_list_visuals</a>                    (void);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a>                <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-depth">gdk_visual_get_best_depth</a>           (void);<a class="link" href="gdk-Visuals.html#GdkVisualType">GdkVisualType</a>       <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-type">gdk_visual_get_best_type</a>            (void);<a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a>*          <a class="link" href="gdk-Visuals.html#gdk-visual-get-system">gdk_visual_get_system</a>               (void);<a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a>*          <a class="link" href="gdk-Visuals.html#gdk-visual-get-best">gdk_visual_get_best</a>                 (void);<a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a>*          <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-with-depth">gdk_visual_get_best_with_depth</a>      (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> depth);<a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a>*          <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-with-type">gdk_visual_get_best_with_type</a>       (<a class="link" href="gdk-Visuals.html#GdkVisualType">GdkVisualType</a> visual_type);<a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a>*          <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-with-both">gdk_visual_get_best_with_both</a>       (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> depth,                                                         <a class="link" href="gdk-Visuals.html#GdkVisualType">GdkVisualType</a> visual_type);#define             <a class="link" href="gdk-Visuals.html#gdk-visual-ref">gdk_visual_ref</a>                      (v)#define             <a class="link" href="gdk-Visuals.html#gdk-visual-unref">gdk_visual_unref</a>                    (v)<a class="link" href="GdkScreen.html" title="GdkScreen">GdkScreen</a>*          <a class="link" href="gdk-Visuals.html#gdk-visual-get-screen">gdk_visual_get_screen</a>               (<a class="link" href="gdk-Visuals.html#GdkVisual">GdkVisual</a> *visual);</pre></div><div class="refsect1" lang="en"><a name="id3154578"></a><h2>Description</h2><p>A <a class="link" href="gdk-Visuals.html#GdkVisual"><span class="type">GdkVisual</span></a> describes a particular video hardware display format. It includesinformation about the number of bits used for each color, the way the bits aretranslated into an RGB value for display, and the way the bits are stored in memory. For example, a piece of display hardware might support 24-bit color, 16-bit color, or 8-bit color; meaning 24/16/8-bit pixel sizes. For a given pixel size, pixels can be in different formats; for example the "red" element of an RGB pixel may be in the top 8 bits of the pixel, or may be in the lower 4 bits.</p><p>Usually you can avoid thinking about visuals in GTK+. Visuals are useful tointerpret the contents of a <a class="link" href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a>, but you should avoid <a class="link" href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a> preciselybecause its contents depend on the display hardware; use <ahref="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> instead, forall but the most low-level purposes. Also, anytime you provide a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>,the visual is implied as part of the colormap (<a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-visual"><code class="function">gdk_colormap_get_visual()</code></a>), soyou won't have to provide a visual in addition.</p><p>There are several standard visuals. The visual returnedby <a class="link" href="gdk-Visuals.html#gdk-visual-get-system"><code class="function">gdk_visual_get_system()</code></a> is the system's defaultvisual. <a class="link" href="gdk-GdkRGB.html#gdk-rgb-get-visual"><code class="function">gdk_rgb_get_visual()</code></a> return the visual mostsuited to displaying full-color image data. If youuse the calls in <span class="type">GdkRGB</span>, you should create your windowsusing this visual (and the colormap returned by<a class="link" href="gdk-GdkRGB.html#gdk-rgb-get-colormap"><code class="function">gdk_rgb_get_colormap()</code></a>).</p><p>A number of functions are provided for determiningthe "best" available visual. For the purposes ofmaking this determination, higher bit depths areconsidered better, and for visuals of the samebit depth, <a class="link" href="gdk-Visuals.html#GDK-VISUAL-PSEUDO-COLOR:CAPS"><code class="literal">GDK_VISUAL_PSEUDO_COLOR</code></a> is preferred at8bpp, otherwise, the visual types are ranked in theorder of (highest to lowest) <a class="link" href="gdk-Visuals.html#GDK-VISUAL-DIRECT-COLOR:CAPS"><code class="literal">GDK_VISUAL_DIRECT_COLOR</code></a>,<a class="link" href="gdk-Visuals.html#GDK-VISUAL-TRUE-COLOR:CAPS"><code class="literal">GDK_VISUAL_TRUE_COLOR</code></a>, <a class="link" href="gdk-Visuals.html#GDK-VISUAL-PSEUDO-COLOR:CAPS"><code class="literal">GDK_VISUAL_PSEUDO_COLOR</code></a>,<a class="link" href="gdk-Visuals.html#GDK-VISUAL-STATIC-COLOR:CAPS"><code class="literal">GDK_VISUAL_STATIC_COLOR</code></a>, <a class="link" href="gdk-Visuals.html#GDK-VISUAL-GRAYSCALE:CAPS"><code class="literal">GDK_VISUAL_GRAYSCALE</code></a>,then <a class="link" href="gdk-Visuals.html#GDK-VISUAL-STATIC-GRAY:CAPS"><code class="literal">GDK_VISUAL_STATIC_GRAY</code></a>.</p></div><div class="refsect1" lang="en"><a name="id3154804"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3154814"></a><h3><a name="GdkVisual"></a>GdkVisual</h3><a class="indexterm" name="id3154827"></a><pre class="programlisting">typedef struct {  GObject parent_instance;    GdkVisualType type;  gint depth;  GdkByteOrder byte_order;  gint colormap_size;  gint bits_per_rgb;  guint32 red_mask;  gint red_shift;  gint red_prec;  guint32 green_mask;  gint green_shift;  gint green_prec;  guint32 blue_mask;  gint blue_shift;  gint blue_prec;} GdkVisual;</pre><p>The <span class="type">GdkVisual</span> structure contains information abouta particular visual.</p><div class="example"><a name="rgbmask"></a><p class="title"><b>Example&#160;5.&#160;Constructing a pixel value from components</b></p><div class="example-contents"><pre class="programlisting">guintpixel_from_rgb (GdkVisual *visual,                guchar r, guchar b, guchar g){  return ((r &gt;&gt; (16 - visual-&gt;red_prec))   &lt;&lt; visual-&gt;red_shift) |         ((g &gt;&gt; (16 - visual-&gt;green_prec)) &lt;&lt; visual-&gt;green_shift) |         ((r &gt;&gt; (16 - visual-&gt;blue_prec))  &lt;&lt; visual-&gt;blue_shift);}</pre></div></div><br class="example-break"><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>&#160;<em class="structfield"><code>parent_instance</code></em>;</span></p></td><td>inherited portion from <ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a></td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Visuals.html#GdkVisualType">GdkVisualType</a>&#160;<em class="structfield"><code>type</code></em>;</span></p></td><td>The type of this visual.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a>&#160;<em class="structfield"><code>depth</code></em>;</span></p></td><td>The number of bits per pixel.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Visuals.html#GdkByteOrder">GdkByteOrder</a>&#160;<em class="structfield"><code>byte_order</code></em>;</span></p></td><td>The byte-order for this visual.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a>&#160;<em class="structfield"><code>colormap_size</code></em>;</span></p></td><td>The number of entries in the colormap, for    visuals of type <a class="link" href="gdk-Visuals.html#GDK-VISUAL-PSEUDO-COLOR:CAPS"><code class="literal">GDK_VISUAL_PSEUDO_COLOR</code></a> or    <code class="literal">GDK_VISUAL_GRAY_SCALE</code>. For other visual types, it    is the number of possible levels per color component.    If the visual has different numbers of levels for    different components, the value of this field is undefined.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a>&#160;<em class="structfield"><code>bits_per_rgb</code></em>;</span></p></td><td>The number of significant bits per red, green, or blue    when specifying colors for this visual. (For instance, for     <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-color"><code class="function">gdk_colormap_alloc_color()</code></a>)</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a>&#160;<em class="structfield"><code>red_mask</code></em>;</span></p></td><td>A mask giving the bits in a pixel value that    correspond to the red field. Significant only for    <code class="literal">GDK_VISUAL_PSEUDOCOLOR</code> and <code class="literal">GDK_VISUAL_DIRECTCOLOR</code>.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a>&#160;<em class="structfield"><code>red_shift</code></em>;</span></p></td><td>The <em class="structfield"><code>red_shift</code></em> and    <em class="structfield"><code>red_prec</code></em> give an alternate presentation    of the information in <em class="structfield"><code>red_mask</code></em>.    <em class="structfield"><code>red_mask</code></em> is a contiguous sequence    of <em class="structfield"><code>red_prec</code></em> bits starting at bit    number <em class="structfield"><code>red_shift</code></em>. For example,    <a class="xref" href="gdk-Visuals.html#rgbmask" title="Example&#160;5.&#160;Constructing a pixel value from components">Example&#160;5, &#8220;Constructing a pixel value from components&#8221;</a> shows constructing a pixel value    out of three 16 bit color values.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a>&#160;<em class="structfield"><code>red_prec</code></em>;</span></p></td><td>See above.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a>&#160;<em class="structfield"><code>green_mask</code></em>;</span></p></td><td>A mask giving the bits in a pixel value that    correspond to the green field.</td></tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -