1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.gdk.Colormap</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gdk-class-reference.html" title="The gtk.gdk Class Reference"><link rel="prev" href="class-gdkcolor.html" title="gtk.gdk.Color"><link rel="next" href="class-gdkcursor.html" title="gtk.gdk.Cursor"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.gdk.Colormap</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gdkcolor.html">Prev</a> </td><th width="60%" align="center">The gtk.gdk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gdkcursor.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gdkcolormap"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.gdk.Colormap</h2><p>gtk.gdk.Colormap — a table of color display component values</p></div><div class="refsect1" lang="en"><a name="id2881278"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.gdk.Colormap</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gdkcolormap.html#constructor-gdkcolormap" title="Constructor">gtk.gdk.Colormap</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>visual</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>allocate</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkcolormap.html#method-gdkcolormap--alloc-color" title="gtk.gdk.Colormap.alloc_color">alloc_color</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>color</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>writeable</code></strong></span><span class="initializer">=False</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>best_match</code></strong></span><span class="initializer">=True</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkcolormap.html#method-gdkcolormap--alloc-color2" title="gtk.gdk.Colormap.alloc_color">alloc_color</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>spec</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>writeable</code></strong></span><span class="initializer">=False</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>best_match</code></strong></span><span class="initializer">=True</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkcolormap.html#method-gdkcolormap--alloc-color3" title="gtk.gdk.Colormap.alloc_color">alloc_color</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>red</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>green</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>blue</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>writeable</code></strong></span><span class="initializer">=False</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>best_match</code></strong></span><span class="initializer">=True</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkcolormap.html#method-gdkcolormap--get-visual" title="gtk.gdk.Colormap.get_visual">get_visual</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkcolormap.html#method-gdkcolormap--get-screen" title="gtk.gdk.Colormap.get_screen">get_screen</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkcolormap.html#method-gdkcolormap--query-color" title="gtk.gdk.Colormap.query_color">query_color</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixel</code></strong></span></span>)</code><br></pre></td></tr></table><pre class="programlisting">
<span class="bold"><strong>Functions</strong></span>
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkcolormap.html#function-gdk--colormap-get-system" title="gtk.gdk.colormap_get_system">gtk.gdk.colormap_get_system</a></span>(<span class="methodparam"></span>)</code></pre></div><div class="refsect1" lang="en"><a name="id2736993"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
+-- <a class="link" href="class-gdkcolormap.html" title="gtk.gdk.Colormap">gtk.gdk.Colormap</a>
</pre></div><div class="refsect1" lang="en"><a name="id2736972"></a><h2>Description</h2><p>A <a class="link" href="class-gdkcolormap.html" title="gtk.gdk.Colormap"><code class="classname">gtk.gdk.Colormap</code></a>
contains a table mapping index values to the RGB color component values used
to display the colors. The index value corresponds to the pixel value of a
<a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>
object and the RGB component values correspond to the <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a> red,
green and blue values. The <a class="link" href="class-gtkwidget.html#method-gtkwidget--get-colormap" title="gtk.Widget.get_colormap"><code class="methodname">gtk.Widget.get_colormap</code>()</a>
method is used to retrieve the colormap used by a widget. The default system
colormap is retrieved by using the <a class="link" href="class-gdkcolormap.html#function-gdk--colormap-get-system" title="gtk.gdk.colormap_get_system"><code class="methodname">gtk.gdk.colormap_get_system</code>()</a>
function. The <a class="link" href="class-gdkcolormap.html#method-gdkcolormap--alloc-color" title="gtk.gdk.Colormap.alloc_color"><code class="methodname">alloc_color</code>()</a>
method has three signatures to allow the color specification using an
unallocated <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>, a
string or a RGB trio.</p></div><div class="refsect1" lang="en"><a name="constructor-gdkcolormap"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.gdk.Colormap</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>visual</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>allocate</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>visual</code></strong> :</span></p></td><td>the <a class="link" href="class-gdkvisual.html" title="gtk.gdk.Visual"><code class="classname">gtk.gdk.Visual</code></a> to
use</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>allocate</code></strong> :</span></p></td><td>if <code class="literal">True</code>, the newly created
colormap will be a private colormap, and all colors in it will be allocated
for the applications use.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkcolormap.html" title="gtk.gdk.Colormap"><code class="classname">gtk.gdk.Colormap</code></a>
object</td></tr></tbody></table><p>Creates a new <a class="link" href="class-gdkcolormap.html" title="gtk.gdk.Colormap"><code class="classname">gtk.gdk.Colormap</code></a>
for the <a class="link" href="class-gdkvisual.html" title="gtk.gdk.Visual"><code class="classname">gtk.gdk.Visual</code></a>
specified by <em class="parameter"><code>visual</code></em>. If
<em class="parameter"><code>allocate</code></em> is <code class="literal">True</code> the colormap will
be a private colormap for the sole use of the application.</p></div><div class="refsect1" lang="en"><a name="id2712826"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gdkcolormap--alloc-color"></a><h3>gtk.gdk.Colormap.alloc_color</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">alloc_color</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>color</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>writeable</code></strong></span><span class="initializer">=False</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>best_match</code></strong></span><span class="initializer">=True</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>color</code></strong> :</span></p></td><td>an unallocated <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>writeable</code></strong> :</span></p></td><td>if <code class="literal">True</code> the colormap entry
is writeable.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>best_match</code></strong> :</span></p></td><td>if <code class="literal">True</code> a best match to the
requested color can be used if needed.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>
object</td></tr></tbody></table><p>The <code class="methodname">alloc_color</code>() method allocates the
color specified by <em class="parameter"><code>color</code></em> in the colormap. The value
of color should be an unallocated <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>. If
<em class="parameter"><code>writeable</code></em> is <code class="literal">True</code> the color is
allocated writeable which means it can be changed after allocation but
cannot be shared with another application. If
<em class="parameter"><code>best_match</code></em> is <code class="literal">True</code> the closest
match to the color will be returned if the request could not be satisfied
exactly.</p><p>This method raises:</p><div class="itemizedlist"><ul type="disc"><li>the ValueError (TypeError prior to PyGTK 2.4) exception if
unable to parse the color specification</li><li>the RuntimeError exception if the color could not be
allocated</li></ul></div><p></p></div><div class="refsect2" lang="en"><a name="method-gdkcolormap--alloc-color2"></a><h3>gtk.gdk.Colormap.alloc_color</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">alloc_color</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>spec</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>writeable</code></strong></span><span class="initializer">=False</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>best_match</code></strong></span><span class="initializer">=True</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>spec</code></strong> :</span></p></td><td>a string containing a color
specification</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>writeable</code></strong> :</span></p></td><td>if <code class="literal">True</code> the colormap entry
is writeable.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>best_match</code></strong> :</span></p></td><td>if <code class="literal">True</code> a best match to the
requested color can be used if needed.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>
object</td></tr></tbody></table><p>The <code class="methodname">alloc_color</code>() method allocates the
color specified by <em class="parameter"><code>spec</code></em> in the colormap. The format
of <em class="parameter"><code>spec</code></em> is a string containing the specification of
the color either as a name (e.g. "navajowhite") as specified in the X11
<code class="filename">rgb.txt</code> file or as a hexadecimal string (e.g.
"#FF0078"). The hexadecimal string must start with '#' and must contain 3
sets of hexadecimal digits of the same length (i.e. 1, 2 ,3 or 4 digits).
For example the following specify the same color value: "#F0A", "#FF00AA",
"#FFF000AAA" and "#FFFF0000AAAA". If <em class="parameter"><code>writeable</code></em> is
<code class="literal">True</code> the color is allocated writeable which means it can
be changed after allocation but cannot be shared with another application.
If <em class="parameter"><code>best_match</code></em> is <code class="literal">True</code> the closest
match to the color will be returned if the request could not be satisfied
exactly.</p><p>This method raises:</p><div class="itemizedlist"><ul type="disc"><li>the ValueError (TypeError prior to PyGTK 2.4) exception if
unable to parse the color specification</li><li>the RuntimeError exception if the color could not be
allocated</li></ul></div><p></p></div><div class="refsect2" lang="en"><a name="method-gdkcolormap--alloc-color3"></a><h3>gtk.gdk.Colormap.alloc_color</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">alloc_color</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>red</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>green</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>blue</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>writeable</code></strong></span><span class="initializer">=False</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>best_match</code></strong></span><span class="initializer">=True</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>red</code></strong> :</span></p></td><td>the red component of the color in the range 0-65535</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>green</code></strong> :</span></p></td><td>the green component of the color in the range 0-65535</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>blue</code></strong> :</span></p></td><td>the blue component of the color in the range 0-65535</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>writeable</code></strong> :</span></p></td><td>a gboolean</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>best_match</code></strong> :</span></p></td><td>a gboolean</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a> object</td></tr></tbody></table><p>The <code class="methodname">alloc_color</code>() method allocates the
color specified by the component values <em class="parameter"><code>red</code></em>,
<em class="parameter"><code>green</code></em> and <em class="parameter"><code>blue</code></em>. If
<em class="parameter"><code>writeable</code></em> is <code class="literal">True</code> the color is
allocated writeable which means it can be changed after allocation but
cannot be shared with another application. If
<em class="parameter"><code>best_match</code></em> is <code class="literal">True</code> the closest
match to the color will be returned if the request could not be satisfied
exactly.</p><p>This method raises:</p><div class="itemizedlist"><ul type="disc"><li>the ValueError (TypeError prior to PyGTK 2.4) exception if
unable to parse the color specification</li><li>the RuntimeError exception if the color could not be
allocated</li></ul></div><p></p></div><div class="refsect2" lang="en"><a name="method-gdkcolormap--get-visual"></a><h3>gtk.gdk.Colormap.get_visual</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_visual</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkvisual.html" title="gtk.gdk.Visual"><code class="classname">gtk.gdk.Visual</code></a></td></tr></tbody></table><p>The <code class="methodname">get_visual</code>() method returns the
visual the colormap was created for. See the <a class="link" href="class-gdkcolormap.html#constructor-gdkcolormap" title="Constructor">gtk.gdk.Colormap</a>
constructor.</p></div><div class="refsect2" lang="en"><a name="method-gdkcolormap--get-screen"></a><h3>gtk.gdk.Colormap.get_screen</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_screen</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkvisual.html" title="gtk.gdk.Visual"><code class="classname">gtk.gdk.Screen</code></a></td></tr></tbody></table><p>The <code class="methodname">get_screen</code>() method returns the
<a class="link" href="class-gdkscreen.html" title="gtk.gdk.Screen"><code class="classname">gtk.gdk.Screen</code></a>
the colormap was created for.</p></div><div class="refsect2" lang="en"><a name="method-gdkcolormap--query-color"></a><h3>gtk.gdk.Colormap.query_color</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">query_color</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pixel</code></strong> :</span></p></td><td>a pixel value</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>
corresponding to <em class="parameter"><code>pixel</code></em></td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">query_color</code>() method returns the
<a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>
corresponding to the hardware pixel value specified by
<em class="parameter"><code>pixel</code></em>. <em class="parameter"><code>pixel</code></em> must be a valid
pixel in the colormap. It's a programmer error to call this method with a
pixel which is not in the colormap. Hardware pixels are normally obtained
from the <a class="link" href="class-gdkcolormap.html#method-gdkcolormap--alloc-color" title="gtk.gdk.Colormap.alloc_color"><code class="methodname">alloc_color</code>()</a>
method, or from a <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a>
object. (A <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a>
contains image data in hardware format while a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
contains image data in a canonical 24-bit RGB format.)</p></div></div><div class="refsect1" lang="en"><a name="id2954962"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-gdk--colormap-get-system"></a><h3>gtk.gdk.colormap_get_system</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.colormap_get_system</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the system' default
colormap</td></tr></tbody></table><p>The <code class="methodname">gtk.gdk.colormap_get_system</code>()
method returns the default colormap used by the system on the default
screen. See the <a class="link" href="class-gdkscreen.html#method-gdkscreen--get-system-colormap" title="gtk.gdk.Screen.get_system_colormap"><code class="methodname">gtk.gdk.Screen.get_system_colormap</code>()</a>
method for more information.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gdkcolor.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gdk-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gdkcursor.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.gdk.Color </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.gdk.Cursor</td></tr></table></div></body></html>
|