File: //usr/share/gtk-doc/html/gdk/gdk-Colormaps-and-Colors.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>Colormaps and Colors</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GDK Reference Manual">
<link rel="up" href="reference.html" title="API Reference">
<link rel="prev" href="gdk-Pixbufs.html" title="Pixbufs">
<link rel="next" href="gdk-Visuals.html" title="Visuals">
<meta name="generator" content="GTK-Doc V1.6 (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">
</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-Pixbufs.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-Visuals.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="#id2986984" class="shortcut">Top</a>
 | 
<a href="#id2987766" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-Colormaps-and-Colors"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2986984"></a><span class="refentrytitle">Colormaps and Colors</span>
</h2>
<p>Colormaps and Colors — Manipulation of colors and colormaps</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 href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a>;
<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>;
<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-new">gdk_colormap_new</a> (<a href="gdk-Visuals.html#GdkVisual">GdkVisual</a> *visual,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> allocate);
<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-ref">gdk_colormap_ref</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap);
void <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-unref">gdk_colormap_unref</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap);
<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-system">gdk_colormap_get_system</a> (void);
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-system-size">gdk_colormap_get_system_size</a> (void);
void <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-change">gdk_colormap_change</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ncolors);
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-colors">gdk_colormap_alloc_colors</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colors,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ncolors,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> writeable,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> best_match,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> *success);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-color">gdk_colormap_alloc_color</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> writeable,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> best_match);
void <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-free-colors">gdk_colormap_free_colors</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colors,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ncolors);
void <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-query-color">gdk_colormap_query_color</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> pixel,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *result);
<a href="gdk-Visuals.html#GdkVisual">GdkVisual</a>* <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-visual">gdk_colormap_get_visual</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap);
<a href="GdkScreen.html" title="GdkScreen">GdkScreen</a>* <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-screen">gdk_colormap_get_screen</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap);
void <a href="gdk-Colormaps-and-Colors.html#gdk-colors-store">gdk_colors_store</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colors,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ncolors);
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a>* <a href="gdk-Colormaps-and-Colors.html#gdk-color-copy">gdk_color_copy</a> (const <a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);
void <a href="gdk-Colormaps-and-Colors.html#gdk-color-free">gdk_color_free</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <a href="gdk-Colormaps-and-Colors.html#gdk-colors-alloc">gdk_colors_alloc</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> contiguous,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> *planes,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> nplanes,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> *pixels,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> npixels);
void <a href="gdk-Colormaps-and-Colors.html#gdk-colors-free">gdk_colors_free</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> *pixels,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> npixels,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> planes);
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <a href="gdk-Colormaps-and-Colors.html#gdk-color-white">gdk_color_white</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <a href="gdk-Colormaps-and-Colors.html#gdk-color-black">gdk_color_black</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="gdk-Colormaps-and-Colors.html#gdk-color-parse">gdk_color_parse</a> (const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *spec,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <a href="gdk-Colormaps-and-Colors.html#gdk-color-alloc">gdk_color_alloc</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <a href="gdk-Colormaps-and-Colors.html#gdk-color-change">gdk_color_change</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="gdk-Colormaps-and-Colors.html#gdk-color-equal">gdk_color_equal</a> (const <a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colora,
const <a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colorb);
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> <a href="gdk-Colormaps-and-Colors.html#gdk-color-hash">gdk_color_hash</a> (const <a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colora);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2987766"></a><h2>Description</h2>
<p>
These functions are used to modify colormaps.
A colormap is an object that contains the mapping
between the color values stored in memory and
the RGB values that are used to display color
values. In general, colormaps only contain
significant information for pseudo-color visuals,
but even for other visual types, a colormap object
is required in some circumstances.
</p>
<p>
There are a couple of special colormaps that can
be retrieved. The system colormap (retrieved
with <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-system"><code class="function">gdk_colormap_get_system()</code></a>) is the default
colormap of the system. If you are using GdkRGB,
there is another colormap that is important - the
colormap in which GdkRGB works, retrieved with
<a href="gdk-GdkRGB.html#gdk-rgb-get-cmap"><code class="function">gdk_rgb_get_cmap()</code></a>. However, when using GdkRGB,
it is not generally necessary to allocate colors
directly.
</p>
<p>
In previous revisions of this interface, a number
of functions that take a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a> parameter
were replaced with functions whose names began
with "gdk_colormap_". This process will probably
be extended somewhat in the future -
<a href="gdk-Colormaps-and-Colors.html#gdk-color-white"><code class="function">gdk_color_white()</code></a>, <a href="gdk-Colormaps-and-Colors.html#gdk-color-black"><code class="function">gdk_color_black()</code></a>, and
<a href="gdk-Colormaps-and-Colors.html#gdk-color-change"><code class="function">gdk_color_change()</code></a> will probably become aliases.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2987864"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2987874"></a><h3>
<a name="GdkColor"></a>GdkColor</h3>
<a class="indexterm" name="id2987887"></a><pre class="programlisting">typedef struct {
guint32 pixel;
guint16 red;
guint16 green;
guint16 blue;
} GdkColor;
</pre>
<p>
The <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a> structure is used to describe an
allocated or unallocated color.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> <em class="structfield"><code>pixel</code></em>;</span></td>
<td>For allocated colors, the value used to
draw this color on the screen.
</td>
</tr>
<tr>
<td>
<span class="term"><a
href="../glib/glib-Basic-Types.html#guint16"
>guint16</a> <em class="structfield"><code>red</code></em>;</span></td>
<td>The red component of the color. This is
a value between 0 and 65535, with 65535 indicating
full intensitiy.
</td>
</tr>
<tr>
<td>
<span class="term"><a
href="../glib/glib-Basic-Types.html#guint16"
>guint16</a> <em class="structfield"><code>green</code></em>;</span></td>
<td>The blue component of the color.
</td>
</tr>
<tr>
<td>
<span class="term"><a
href="../glib/glib-Basic-Types.html#guint16"
>guint16</a> <em class="structfield"><code>blue</code></em>;</span></td>
<td>The green component of the color.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988001"></a><h3>
<a name="GdkColormap"></a>GdkColormap</h3>
<a class="indexterm" name="id2988013"></a><pre class="programlisting">typedef struct {
gint size;
GdkColor *colors;
} GdkColormap;
</pre>
<p>
The colormap structure contains the following public fields.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <em class="structfield"><code>size</code></em>;</span></td>
<td>For pseudo-color colormaps, the number of colors
in the colormap.
</td>
</tr>
<tr>
<td>
<span class="term"><a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *<em class="structfield"><code>colors</code></em>;</span></td>
<td>An array containing the current values in the
colormap. This can be used to map from pixel values
back to RGB values. This is only meaningful for
pseudo-color colormaps.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988079"></a><h3>
<a name="gdk-colormap-new"></a>gdk_colormap_new ()</h3>
<a class="indexterm" name="id2988092"></a><pre class="programlisting"><a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* gdk_colormap_new (<a href="gdk-Visuals.html#GdkVisual">GdkVisual</a> *visual,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> allocate);</pre>
<p>
Creates a new colormap for the given visual.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>visual</code></em> :</span></td>
<td> a <a href="gdk-Visuals.html#GdkVisual"><span class="type">GdkVisual</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>allocate</code></em> :</span></td>
<td> if <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, 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>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the new <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988201"></a><h3>
<a name="gdk-colormap-ref"></a>gdk_colormap_ref ()</h3>
<a class="indexterm" name="id2988216"></a><pre class="programlisting"><a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* gdk_colormap_ref (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colormap_ref</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Deprecated function; use <a
href="../gobject/gobject-The-Base-Object-Type.html#g-object-ref"
><code class="function">g_object_ref()</code></a> instead.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cmap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the colormap
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988307"></a><h3>
<a name="gdk-colormap-unref"></a>gdk_colormap_unref ()</h3>
<a class="indexterm" name="id2988323"></a><pre class="programlisting">void gdk_colormap_unref (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colormap_unref</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Deprecated function; use <a
href="../gobject/gobject-The-Base-Object-Type.html#g-object-ref"
><code class="function">g_object_ref()</code></a> instead.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>cmap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988403"></a><h3>
<a name="gdk-colormap-get-system"></a>gdk_colormap_get_system ()</h3>
<a class="indexterm" name="id2988416"></a><pre class="programlisting"><a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* gdk_colormap_get_system (void);</pre>
<p>
Gets the system's default colormap for the default screen. (See
<code class="function">gdk_colormap_get_system_for_screen()</code>)</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the default colormap.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988470"></a><h3>
<a name="gdk-colormap-get-system-size"></a>gdk_colormap_get_system_size ()</h3>
<a class="indexterm" name="id2988485"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> gdk_colormap_get_system_size (void);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colormap_get_system_size</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Returns the size of the system's default colormap.
(See the description of struct <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a> for an
explanation of the size of a colormap.)</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the size of the system's default colormap.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988548"></a><h3>
<a name="gdk-colormap-change"></a>gdk_colormap_change ()</h3>
<a class="indexterm" name="id2988564"></a><pre class="programlisting">void gdk_colormap_change (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ncolors);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colormap_change</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Changes the value of the first <em class="parameter"><code>ncolors</code></em> in a private colormap
to match the values in the <em class="structfield"><code>colors</code></em>
array in the colormap. This function is obsolete and
should not be used. See <a href="gdk-Colormaps-and-Colors.html#gdk-color-change"><code class="function">gdk_color_change()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>ncolors</code></em> :</span></td>
<td> the number of colors to change.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988677"></a><h3>
<a name="gdk-colormap-alloc-colors"></a>gdk_colormap_alloc_colors ()</h3>
<a class="indexterm" name="id2988691"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> gdk_colormap_alloc_colors (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colors,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ncolors,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> writeable,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> best_match,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> *success);</pre>
<p>
Allocates colors from a colormap.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>colors</code></em> :</span></td>
<td> The color values to allocate. On return, the pixel
values for allocated colors will be filled in.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>ncolors</code></em> :</span></td>
<td> The number of colors in <em class="parameter"><code>colors</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>writeable</code></em> :</span></td>
<td> If <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, the colors are allocated writeable
(their values can later be changed using <a href="gdk-Colormaps-and-Colors.html#gdk-color-change"><code class="function">gdk_color_change()</code></a>).
Writeable colors cannot be shared between applications.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>best_match</code></em> :</span></td>
<td> If <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, GDK will attempt to do matching against
existing colors if the colors cannot be allocated as requested.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>success</code></em> :</span></td>
<td> An array of length <em class="parameter"><code>ncolors</code></em>. On return, this
indicates whether the corresponding color in <em class="parameter"><code>colors</code></em> was
successfully allocated or not.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The number of colors that were not successfully
allocated.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988923"></a><h3>
<a name="gdk-colormap-alloc-color"></a>gdk_colormap_alloc_color ()</h3>
<a class="indexterm" name="id2988937"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gdk_colormap_alloc_color (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> writeable,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> best_match);</pre>
<p>
Allocates a single color from a colormap.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color</code></em> :</span></td>
<td> the color to allocate. On return the
<em class="structfield"><code>pixel</code></em> field will be
filled in if allocation succeeds.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>writeable</code></em> :</span></td>
<td> If <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, the color is allocated writeable
(their values can later be changed using <a href="gdk-Colormaps-and-Colors.html#gdk-color-change"><code class="function">gdk_color_change()</code></a>).
Writeable colors cannot be shared between applications.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>best_match</code></em> :</span></td>
<td> If <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, GDK will attempt to do matching against
existing colors if the color cannot be allocated as requested.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the allocation succeeded.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989120"></a><h3>
<a name="gdk-colormap-free-colors"></a>gdk_colormap_free_colors ()</h3>
<a class="indexterm" name="id2989133"></a><pre class="programlisting">void gdk_colormap_free_colors (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colors,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ncolors);</pre>
<p>
Frees previously allocated colors.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>colors</code></em> :</span></td>
<td> the colors to free.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>ncolors</code></em> :</span></td>
<td> the number of colors in <em class="parameter"><code>colors</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989240"></a><h3>
<a name="gdk-colormap-query-color"></a>gdk_colormap_query_color ()</h3>
<a class="indexterm" name="id2989252"></a><pre class="programlisting">void gdk_colormap_query_color (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> pixel,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *result);</pre>
<p>
Locates the RGB color in <em class="parameter"><code>colormap</code></em> corresponding to the given
hardware pixel <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 function with a
pixel which is not in the colormap. Hardware pixels are normally
obtained from <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-colors"><code class="function">gdk_colormap_alloc_colors()</code></a>, or from a <a href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a>. (A
<a href="gdk-Images.html#GdkImage"><span class="type">GdkImage</span></a> contains image data in hardware format, a <a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
><span class="type">GdkPixbuf</span></a>
contains image data in a canonical 24-bit RGB format.)
</p>
<p>
This function is rarely useful; it's used for example to
implement the eyedropper feature in <a
href="../gtk/GtkColorSelection.html"
><span class="type">GtkColorSelection</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixel</code></em> :</span></td>
<td> pixel value in hardware display format
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>result</code></em> :</span></td>
<td> <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a> with red, green, blue fields initialized
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989434"></a><h3>
<a name="gdk-colormap-get-visual"></a>gdk_colormap_get_visual ()</h3>
<a class="indexterm" name="id2989447"></a><pre class="programlisting"><a href="gdk-Visuals.html#GdkVisual">GdkVisual</a>* gdk_colormap_get_visual (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap);</pre>
<p>
Returns the visual for which a given colormap was created.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the visual of the colormap.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989516"></a><h3>
<a name="gdk-colormap-get-screen"></a>gdk_colormap_get_screen ()</h3>
<a class="indexterm" name="id2989531"></a><pre class="programlisting"><a href="GdkScreen.html" title="GdkScreen">GdkScreen</a>* gdk_colormap_get_screen (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap);</pre>
<p>
Gets the screen for which this colormap was created.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cmap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the screen for which this colormap was created.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989604"></a><h3>
<a name="gdk-colors-store"></a>gdk_colors_store ()</h3>
<a class="indexterm" name="id2989620"></a><pre class="programlisting">void gdk_colors_store (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colors,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ncolors);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colors_store</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Changes the value of the first <em class="parameter"><code>ncolors</code></em> colors in
a private colormap. This function is obsolete and
should not be used. See <a href="gdk-Colormaps-and-Colors.html#gdk-color-change"><code class="function">gdk_color_change()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>colors</code></em> :</span></td>
<td> the new color values.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>ncolors</code></em> :</span></td>
<td> the number of colors to change.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989751"></a><h3>
<a name="gdk-color-copy"></a>gdk_color_copy ()</h3>
<a class="indexterm" name="id2989763"></a><pre class="programlisting"><a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a>* gdk_color_copy (const <a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);</pre>
<p>
Makes a copy of a color structure. The result
must be freed using <a href="gdk-Colormaps-and-Colors.html#gdk-color-free"><code class="function">gdk_color_free()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>color</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a copy of <em class="parameter"><code>color</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989848"></a><h3>
<a name="gdk-color-free"></a>gdk_color_free ()</h3>
<a class="indexterm" name="id2989861"></a><pre class="programlisting">void gdk_color_free (<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);</pre>
<p>
Frees a color structure created with
<a href="gdk-Colormaps-and-Colors.html#gdk-color-copy"><code class="function">gdk_color_copy()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>color</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989929"></a><h3>
<a name="gdk-colors-alloc"></a>gdk_colors_alloc ()</h3>
<a class="indexterm" name="id2989944"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> gdk_colors_alloc (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> contiguous,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> *planes,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> nplanes,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> *pixels,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> npixels);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colors_alloc</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Allocates colors from a colormap. This function
is obsolete. See <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-colors"><code class="function">gdk_colormap_alloc_colors()</code></a>.
For full documentation of the fields, see
the Xlib documentation for <code class="function"><code class="function">XAllocColorCells()</code></code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>contiguous</code></em> :</span></td>
<td> if <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, the colors should be allocated
in contiguous color cells.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>planes</code></em> :</span></td>
<td> an array in which to store the plane masks.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>nplanes</code></em> :</span></td>
<td> the number of planes to allocate. (Or zero,
to indicate that the color allocation should not be planar.)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixels</code></em> :</span></td>
<td> an array into which to store allocated pixel values.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>npixels</code></em> :</span></td>
<td> the number of pixels in each plane to allocate.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the allocation was successful
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990185"></a><h3>
<a name="gdk-colors-free"></a>gdk_colors_free ()</h3>
<a class="indexterm" name="id2990200"></a><pre class="programlisting">void gdk_colors_free (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> *pixels,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> npixels,
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> planes);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colors_free</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Frees colors allocated with <a href="gdk-Colormaps-and-Colors.html#gdk-colors-alloc"><code class="function">gdk_colors_alloc()</code></a>. This
function is obsolete. See <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-free-colors"><code class="function">gdk_colormap_free_colors()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixels</code></em> :</span></td>
<td> the pixel values of the colors to free.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>npixels</code></em> :</span></td>
<td> the number of values in <em class="parameter"><code>pixels</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>planes</code></em> :</span></td>
<td> the plane masks for all planes to free, OR'd together.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990364"></a><h3>
<a name="gdk-color-white"></a>gdk_color_white ()</h3>
<a class="indexterm" name="id2990379"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> gdk_color_white (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_color_white</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Returns the white color for a given colormap. The resulting
value has already allocated been allocated.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color</code></em> :</span></td>
<td> the location to store the color.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the allocation succeeded.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990493"></a><h3>
<a name="gdk-color-black"></a>gdk_color_black ()</h3>
<a class="indexterm" name="id2990508"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> gdk_color_black (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_color_black</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Returns the black color for a given colormap. The resulting
value has already benn allocated.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color</code></em> :</span></td>
<td> the location to store the color.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the allocation succeeded.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990621"></a><h3>
<a name="gdk-color-parse"></a>gdk_color_parse ()</h3>
<a class="indexterm" name="id2990634"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gdk_color_parse (const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *spec,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);</pre>
<p>
Parses a textual specification of a color and fill in
the <em class="structfield"><code>red</code></em>,
<em class="structfield"><code>green</code></em>, and
<em class="structfield"><code>blue</code></em> fields of a
<a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a> structure. The color is <span class="emphasis"><em>not</em></span>
allocated, you must call <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-color"><code class="function">gdk_colormap_alloc_color()</code></a> yourself.
The text string can be in any of the forms accepted
by <code class="function">XParseColor</code>; these include
name for a color from <code class="filename">rgb.txt</code>, such as
<code class="literal">DarkSlateGray</code>, or a hex specification
such as <code class="literal">#3050b2</code> or <code class="literal">#35b</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>spec</code></em> :</span></td>
<td> the string specifying the color.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color</code></em> :</span></td>
<td> the <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a> to fill in
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the parsing succeeded.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990801"></a><h3>
<a name="gdk-color-alloc"></a>gdk_color_alloc ()</h3>
<a class="indexterm" name="id2990817"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> gdk_color_alloc (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_color_alloc</code> is deprecated and should not be used in newly-written code. Use <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-color"><code class="function">gdk_colormap_alloc_color()</code></a> instead.</p>
</div>
<p>
Allocates a single color from a colormap.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color</code></em> :</span></td>
<td> The color to allocate. On return, the
<em class="structfield"><code>pixel</code></em> field will be filled in.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the allocation succeeded.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990945"></a><h3>
<a name="gdk-color-change"></a>gdk_color_change ()</h3>
<a class="indexterm" name="id2990960"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> gdk_color_change (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_color_change</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Changes the value of a color that has already
been allocated. If <em class="parameter"><code>colormap</code></em> is not a private
colormap, then the color must have been allocated
using <a href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-colors"><code class="function">gdk_colormap_alloc_colors()</code></a> with the
<em class="parameter"><code>writeable</code></em> set to <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colormap</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>color</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a>, with the color to change
in the <em class="structfield"><code>pixel</code></em> field,
and the new value in the remaining fields.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the color was successfully changed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991120"></a><h3>
<a name="gdk-color-equal"></a>gdk_color_equal ()</h3>
<a class="indexterm" name="id2991132"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gdk_color_equal (const <a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colora,
const <a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colorb);</pre>
<p>
Compares two colors.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colora</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>colorb</code></em> :</span></td>
<td> another <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the two colors compare equal
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991240"></a><h3>
<a name="gdk-color-hash"></a>gdk_color_hash ()</h3>
<a class="indexterm" name="id2991252"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> gdk_color_hash (const <a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *colora);</pre>
<p>
A hash function suitable for using for a hash
table that stores <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a>'s.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colora</code></em> :</span></td>
<td> a <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The hash function appled to <em class="parameter"><code>colora</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>