|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21572/root/usr/share/gtk-doc/html/gdk/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>GdkRGB</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-Bitmaps-and-Pixmaps.html" title="Bitmaps and Pixmaps">
<link rel="next" href="gdk-Images.html" title="Images">
<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-Bitmaps-and-Pixmaps.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-Images.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="#id2967006" class="shortcut">Top</a>
 | 
<a href="#id2967910" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-GdkRGB"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2967006"></a><span class="refentrytitle">GdkRGB</span>
</h2>
<p>GdkRGB — Renders RGB, grayscale, or indexed image data to a GdkDrawable</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <gdk/gdk.h>
void <a href="gdk-GdkRGB.html#gdk-rgb-init">gdk_rgb_init</a> (void);
void <a href="gdk-GdkRGB.html#gdk-draw-rgb-image">gdk_draw_rgb_image</a> (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *rgb_buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);
void <a href="gdk-GdkRGB.html#gdk-draw-rgb-image-dithalign">gdk_draw_rgb_image_dithalign</a> (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *rgb_buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> xdith,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ydith);
void <a href="gdk-GdkRGB.html#gdk-draw-indexed-image">gdk_draw_indexed_image</a> (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
<a href="gdk-GdkRGB.html#GdkRgbCmap">GdkRgbCmap</a> *cmap);
void <a href="gdk-GdkRGB.html#gdk-draw-gray-image">gdk_draw_gray_image</a> (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);
void <a href="gdk-GdkRGB.html#gdk-draw-rgb-32-image">gdk_draw_rgb_32_image</a> (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);
void <a href="gdk-GdkRGB.html#gdk-draw-rgb-32-image-dithalign">gdk_draw_rgb_32_image_dithalign</a> (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> xdith,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ydith);
enum <a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a>;
<a href="gdk-GdkRGB.html#GdkRgbCmap">GdkRgbCmap</a>* <a href="gdk-GdkRGB.html#gdk-rgb-cmap-new">gdk_rgb_cmap_new</a> (<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> *colors,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> n_colors);
void <a href="gdk-GdkRGB.html#gdk-rgb-cmap-free">gdk_rgb_cmap_free</a> (<a href="gdk-GdkRGB.html#GdkRgbCmap">GdkRgbCmap</a> *cmap);
<a href="gdk-GdkRGB.html#GdkRgbCmap">GdkRgbCmap</a>;
void <a href="gdk-GdkRGB.html#gdk-rgb-gc-set-foreground">gdk_rgb_gc_set_foreground</a> (<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);
void <a href="gdk-GdkRGB.html#gdk-rgb-gc-set-background">gdk_rgb_gc_set_background</a> (<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);
<a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> <a href="gdk-GdkRGB.html#gdk-rgb-xpixel-from-rgb">gdk_rgb_xpixel_from_rgb</a> (<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);
void <a href="gdk-GdkRGB.html#gdk-rgb-find-color">gdk_rgb_find_color</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);
void <a href="gdk-GdkRGB.html#gdk-rgb-set-install">gdk_rgb_set_install</a> (<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> install);
void <a href="gdk-GdkRGB.html#gdk-rgb-set-min-colors">gdk_rgb_set_min_colors</a> (<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> min_colors);
<a href="gdk-Visuals.html#GdkVisual">GdkVisual</a>* <a href="gdk-GdkRGB.html#gdk-rgb-get-visual">gdk_rgb_get_visual</a> (void);
<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* <a href="gdk-GdkRGB.html#gdk-rgb-get-colormap">gdk_rgb_get_colormap</a> (void);
#define <a href="gdk-GdkRGB.html#gdk-rgb-get-cmap">gdk_rgb_get_cmap</a>
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="gdk-GdkRGB.html#gdk-rgb-ditherable">gdk_rgb_ditherable</a> (void);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="gdk-GdkRGB.html#gdk-rgb-colormap-ditherable">gdk_rgb_colormap_ditherable</a> (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap);
void <a href="gdk-GdkRGB.html#gdk-rgb-set-verbose">gdk_rgb_set_verbose</a> (<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> verbose);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2967910"></a><h2>Description</h2>
<p>
GdkRGB is a low-level module which renders RGB, grayscale, and indexed
colormap images to a <a href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a>. It does this as efficiently as
possible, handling issues such as colormaps, visuals, dithering,
temporary buffers, and so on. Most code should use the higher-level
<a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
><span class="type">GdkPixbuf</span></a> features in place of this module; for example,
<a href="gdk-Pixbufs.html#gdk-pixbuf-render-to-drawable"><code class="function">gdk_pixbuf_render_to_drawable()</code></a> uses GdkRGB in its implementation.
</p>
<p>
GdkRGB allocates a color cube to use when rendering images. You can
set the threshold for installing colormaps with
<a href="gdk-GdkRGB.html#gdk-rgb-set-min-colors"><code class="function">gdk_rgb_set_min_colors()</code></a>. The default is 5x5x5 (125). If a colorcube
of this size or larger can be allocated in the default colormap, then
that's done. Otherwise, GdkRGB creates its own private colormap.
Setting it to 0 means that it always tries to use the default
colormap, and setting it to 216 means that it always creates a private
one if it cannot allocate the 6x6x6 colormap in the default. If you
always want a private colormap (to avoid consuming too many colormap
entries for other apps, say), you can use
<code class="literal">gdk_rgb_set_install(TRUE)</code>.
Setting the value greater than 216 exercises a bug in older versions
of GdkRGB. Note, however, that setting it to 0 doesn't let you get
away with ignoring the colormap and visual - a colormap is always
created in grayscale and direct color modes, and the visual is changed
in cases where a "better" visual than the default is available.
</p>
<div class="example">
<a name="id2967994"></a><p class="title"><b>Example 4. A simple example program using GdkRGB</b></p>
<pre class="programlisting">
#include <gtk/gtk.h>
#define IMAGE_WIDTH 256
#define IMAGE_HEIGHT 256
guchar rgbbuf[IMAGE_WIDTH * IMAGE_HEIGHT * 3];
gboolean on_darea_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer user_data);
int
main (int argc, char *argv[])
{
GtkWidget *window, *darea;
gint x, y;
guchar *pos;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
darea = gtk_drawing_area_new ();
gtk_widget_set_size_request (darea, IMAGE_WIDTH, IMAGE_HEIGHT);
gtk_container_add (GTK_CONTAINER (window), darea);
gtk_signal_connect (GTK_OBJECT (darea), "expose-event",
GTK_SIGNAL_FUNC (on_darea_expose), NULL);
gtk_widget_show_all (window);
/* Set up the RGB buffer. */
pos = rgbbuf;
for (y = 0; y < IMAGE_HEIGHT; y++)
{
for (x = 0; x < IMAGE_WIDTH; x++)
{
*pos++ = x - x % 32; /* Red. */
*pos++ = (x / 32) * 4 + y - y % 32; /* Green. */
*pos++ = y - y % 32; /* Blue. */
}
}
gtk_main ();
return 0;
}
gboolean
on_darea_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer user_data)
{
gdk_draw_rgb_image (widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
GDK_RGB_DITHER_MAX, rgbbuf, IMAGE_WIDTH * 3);
return TRUE;
}
</pre>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2968041"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2968051"></a><h3>
<a name="gdk-rgb-init"></a>gdk_rgb_init ()</h3>
<a class="indexterm" name="id2968065"></a><pre class="programlisting">void gdk_rgb_init (void);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_init</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
This function no longer does anything at all. It's completely useless
(and harmless).
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2968101"></a><h3>
<a name="gdk-draw-rgb-image"></a>gdk_draw_rgb_image ()</h3>
<a class="indexterm" name="id2968114"></a><pre class="programlisting">void gdk_draw_rgb_image (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *rgb_buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);</pre>
<p>
Draws an RGB image in the drawable. This is the core GdkRGB
function, and likely the only one you will need to use.
</p>
<p>
The <em class="parameter"><code>rowstride</code></em> parameter allows for lines to be aligned more flexibly.
For example, lines may be allocated to begin on 32-bit boundaries,
even if the width of the rectangle is odd. Rowstride is also useful
when drawing a subrectangle of a larger image in memory. Finally, to
replicate the same line a number of times, the trick of setting
<em class="parameter"><code>rowstride</code></em> to 0 is allowed.
</p>
<p>
In general, for 0 <= i < <em class="parameter"><code>width</code></em> and 0 <= j < height,
the pixel (x + i, y + j) is colored with red value <em class="parameter"><code>rgb_buf</code></em>[<em class="parameter"><code>j</code></em> *
<em class="parameter"><code>rowstride</code></em> + <em class="parameter"><code>i</code></em> * 3], green value <em class="parameter"><code>rgb_buf</code></em>[<em class="parameter"><code>j</code></em> * <em class="parameter"><code>rowstride</code></em> + <em class="parameter"><code>i</code></em> * 3 +
1], and blue value <em class="parameter"><code>rgb_buf</code></em>[<em class="parameter"><code>j</code></em> * <em class="parameter"><code>rowstride</code></em> + <em class="parameter"><code>i</code></em> * 3 + 2].
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td>The <a href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>gc</code></em> :</span></td>
<td>The graphics context (all GDK drawing operations require one; its
contents are ignored).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em> :</span></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y</code></em> :</span></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dith</code></em> :</span></td>
<td>A <a href="gdk-GdkRGB.html#GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rgb_buf</code></em> :</span></td>
<td>The pixel data, represented as packed 24-bit data.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rowstride</code></em> :</span></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>rgb_buf</code></em> to the
start of the next.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2968472"></a><h3>
<a name="gdk-draw-rgb-image-dithalign"></a>gdk_draw_rgb_image_dithalign ()</h3>
<a class="indexterm" name="id2968486"></a><pre class="programlisting">void gdk_draw_rgb_image_dithalign (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *rgb_buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> xdith,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ydith);</pre>
<p>
Draws an RGB image in the drawable, with an adjustment for dither alignment.
</p>
<p>
This function is useful when drawing dithered images into a window
that may be scrolled. Pixel (x, y) will be drawn dithered as if its
actual location is (x + <em class="parameter"><code>xdith</code></em>, y + <em class="parameter"><code>ydith</code></em>). Thus, if you draw an
image into a window using zero dither alignment, then scroll up one
pixel, subsequent draws to the window should have <em class="parameter"><code>ydith</code></em> = 1.
</p>
<p>
Setting the dither alignment correctly allows updating of small parts
of the screen while avoiding visible "seams" between the different
dither textures.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td>The <a href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>gc</code></em> :</span></td>
<td>The graphics context.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em> :</span></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y</code></em> :</span></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dith</code></em> :</span></td>
<td>A <a href="gdk-GdkRGB.html#GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rgb_buf</code></em> :</span></td>
<td>The pixel data, represented as packed 24-bit data.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rowstride</code></em> :</span></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>rgb_buf</code></em> to the
start of the next.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>xdith</code></em> :</span></td>
<td>An x offset for dither alignment.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>ydith</code></em> :</span></td>
<td>A y offset for dither alignment.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2968815"></a><h3>
<a name="gdk-draw-indexed-image"></a>gdk_draw_indexed_image ()</h3>
<a class="indexterm" name="id2968829"></a><pre class="programlisting">void gdk_draw_indexed_image (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
<a href="gdk-GdkRGB.html#GdkRgbCmap">GdkRgbCmap</a> *cmap);</pre>
<p>
Draws an indexed image in the drawable, using a <a href="gdk-GdkRGB.html#GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> to assign
actual colors to the color indices.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td>The <a href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>gc</code></em> :</span></td>
<td>The graphics context.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em> :</span></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y</code></em> :</span></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dith</code></em> :</span></td>
<td>A <a href="gdk-GdkRGB.html#GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buf</code></em> :</span></td>
<td>The pixel data, represented as 8-bit color indices.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rowstride</code></em> :</span></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>buf</code></em> to the
start of the next.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>cmap</code></em> :</span></td>
<td>The <a href="gdk-GdkRGB.html#GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> used to assign colors to the color indices.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2969120"></a><h3>
<a name="gdk-draw-gray-image"></a>gdk_draw_gray_image ()</h3>
<a class="indexterm" name="id2969133"></a><pre class="programlisting">void gdk_draw_gray_image (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);</pre>
<p>
Draws a grayscale image in the drawable.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td>The <a href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>gc</code></em> :</span></td>
<td>The graphics context.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em> :</span></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y</code></em> :</span></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dith</code></em> :</span></td>
<td>A <a href="gdk-GdkRGB.html#GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buf</code></em> :</span></td>
<td>The pixel data, represented as 8-bit gray values.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rowstride</code></em> :</span></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>buf</code></em> to the
start of the next.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2969386"></a><h3>
<a name="gdk-draw-rgb-32-image"></a>gdk_draw_rgb_32_image ()</h3>
<a class="indexterm" name="id2969399"></a><pre class="programlisting">void gdk_draw_rgb_32_image (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride);</pre>
<p>
Draws a padded RGB image in the drawable. The image is stored as one
pixel per 32-bit word. It is laid out as a red byte, a green byte, a
blue byte, and a padding byte.
</p>
<p>
It's unlikely that this function will give significant performance
gains in practice. In my experience, the performance gain from having
pixels aligned to 32-bit boundaries is cancelled out by the increased
memory bandwidth.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td>The <a href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> to draw in (usually a <a href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a>).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>gc</code></em> :</span></td>
<td>The graphics context.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em> :</span></td>
<td>The x coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y</code></em> :</span></td>
<td>The y coordinate of the top-left corner in the drawable.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td>The width of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td>The height of the rectangle to be drawn.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dith</code></em> :</span></td>
<td>A <a href="gdk-GdkRGB.html#GdkRgbDither"><span class="type">GdkRgbDither</span></a> value, selecting the desired dither mode.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buf</code></em> :</span></td>
<td>The pixel data, represented as padded 32-bit data.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rowstride</code></em> :</span></td>
<td>The number of bytes from the start of one row in <em class="parameter"><code>buf</code></em> to the
start of the next.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2969661"></a><h3>
<a name="gdk-draw-rgb-32-image-dithalign"></a>gdk_draw_rgb_32_image_dithalign ()</h3>
<a class="indexterm" name="id2969675"></a><pre class="programlisting">void gdk_draw_rgb_32_image_dithalign (<a href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable,
<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> y,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> width,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> height,
<a href="gdk-GdkRGB.html#GdkRgbDither">GdkRgbDither</a> dith,
<a
href="../glib/glib-Basic-Types.html#guchar"
>guchar</a> *buf,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> rowstride,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> xdith,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> ydith);</pre>
<p>
Like <a href="gdk-GdkRGB.html#gdk-draw-rgb-32-image"><code class="function">gdk_draw_rgb_32_image()</code></a>, but allows you to specify the dither
offsets. See <a href="gdk-GdkRGB.html#gdk-draw-rgb-image-dithalign"><code class="function">gdk_draw_rgb_image_dithalign()</code></a> for more details.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td>
<td> a <a href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>gc</code></em> :</span></td>
<td> a <a href="gdk-Graphics-Contexts.html#GdkGC"><span class="type">GdkGC</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em> :</span></td>
<td> X coordinate on <em class="parameter"><code>drawable</code></em> where image should go
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y</code></em> :</span></td>
<td> Y coordinate on <em class="parameter"><code>drawable</code></em> where image should go
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>width</code></em> :</span></td>
<td> width of area of image to draw
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>height</code></em> :</span></td>
<td> height of area of image to draw
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dith</code></em> :</span></td>
<td> dithering mode
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buf</code></em> :</span></td>
<td> RGB image data
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rowstride</code></em> :</span></td>
<td> rowstride of RGB image data
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>xdith</code></em> :</span></td>
<td> X dither offset
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>ydith</code></em> :</span></td>
<td> Y dither offset
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2969991"></a><h3>
<a name="GdkRgbDither"></a>enum GdkRgbDither</h3>
<a class="indexterm" name="id2970004"></a><pre class="programlisting">typedef enum
{
GDK_RGB_DITHER_NONE,
GDK_RGB_DITHER_NORMAL,
GDK_RGB_DITHER_MAX
} GdkRgbDither;
</pre>
<p>
Selects whether or not GdkRGB applies dithering
to the image on display.
</p>
<p>
Since GdkRGB currently only handles images with 8 bits per component,
dithering on 24 bit per pixel displays is a moot point.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="GDK-RGB-DITHER-NONE:CAPS"></a><code class="literal">GDK_RGB_DITHER_NONE</code></span></td>
<td>Never use dithering.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GDK-RGB-DITHER-NORMAL:CAPS"></a><code class="literal">GDK_RGB_DITHER_NORMAL</code></span></td>
<td>Use dithering in 8 bits per pixel (and below)
only.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GDK-RGB-DITHER-MAX:CAPS"></a><code class="literal">GDK_RGB_DITHER_MAX</code></span></td>
<td>Use dithering in 16 bits per pixel and below.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2970102"></a><h3>
<a name="gdk-rgb-cmap-new"></a>gdk_rgb_cmap_new ()</h3>
<a class="indexterm" name="id2970114"></a><pre class="programlisting"><a href="gdk-GdkRGB.html#GdkRgbCmap">GdkRgbCmap</a>* gdk_rgb_cmap_new (<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> *colors,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> n_colors);</pre>
<p>
Creates a new <a href="gdk-GdkRGB.html#GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> structure. The cmap maps color indexes to
RGB colors. If <em class="parameter"><code>n_colors</code></em> is less than 256, then images containing
color values greater than or equal to <em class="parameter"><code>n_colors</code></em> will produce undefined
results, including possibly segfaults.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>colors</code></em> :</span></td>
<td>The colors, represented as 0xRRGGBB integer values.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>n_colors</code></em> :</span></td>
<td>The number of colors in the cmap.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>The newly created <a href="gdk-GdkRGB.html#GdkRgbCmap"><span class="type">GdkRgbCmap</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2970224"></a><h3>
<a name="gdk-rgb-cmap-free"></a>gdk_rgb_cmap_free ()</h3>
<a class="indexterm" name="id2970238"></a><pre class="programlisting">void gdk_rgb_cmap_free (<a href="gdk-GdkRGB.html#GdkRgbCmap">GdkRgbCmap</a> *cmap);</pre>
<p>
Frees the memory associated with a <a href="gdk-GdkRGB.html#GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> created by <a href="gdk-GdkRGB.html#gdk-rgb-cmap-new"><code class="function">gdk_rgb_cmap_new()</code></a>.
</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>The <a href="gdk-GdkRGB.html#GdkRgbCmap"><span class="type">GdkRgbCmap</span></a> to free.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2970311"></a><h3>
<a name="GdkRgbCmap"></a>GdkRgbCmap</h3>
<a class="indexterm" name="id2970323"></a><pre class="programlisting">typedef struct {
guint32 colors[256];
gint n_colors;
} GdkRgbCmap;
</pre>
<p>
A private data structure which maps color indices to actual RGB
colors. This is used only for <a href="gdk-GdkRGB.html#gdk-draw-indexed-image"><code class="function">gdk_draw_indexed_image()</code></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2970352"></a><h3>
<a name="gdk-rgb-gc-set-foreground"></a>gdk_rgb_gc_set_foreground ()</h3>
<a class="indexterm" name="id2970368"></a><pre class="programlisting">void gdk_rgb_gc_set_foreground (<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_gc_set_foreground</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Sets the foreground color in <em class="parameter"><code>gc</code></em> to the specified color (or the
closest approximation, in the case of limited visuals).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>gc</code></em> :</span></td>
<td>The <a href="gdk-Graphics-Contexts.html#GdkGC"><span class="type">GdkGC</span></a> to modify.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rgb</code></em> :</span></td>
<td>The color, represented as a 0xRRGGBB integer value.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2970464"></a><h3>
<a name="gdk-rgb-gc-set-background"></a>gdk_rgb_gc_set_background ()</h3>
<a class="indexterm" name="id2970480"></a><pre class="programlisting">void gdk_rgb_gc_set_background (<a href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_gc_set_background</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Sets the background color in <em class="parameter"><code>gc</code></em> to the specified color (or the
closest approximation, in the case of limited visuals).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>gc</code></em> :</span></td>
<td>The <a href="gdk-Graphics-Contexts.html#GdkGC"><span class="type">GdkGC</span></a> to modify.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>rgb</code></em> :</span></td>
<td>The color, represented as a 0xRRGGBB integer value.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2970576"></a><h3>
<a name="gdk-rgb-xpixel-from-rgb"></a>gdk_rgb_xpixel_from_rgb ()</h3>
<a class="indexterm" name="id2970592"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gulong"
>gulong</a> gdk_rgb_xpixel_from_rgb (<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> rgb);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_xpixel_from_rgb</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Finds the X pixel closest in color to the <em class="parameter"><code>rgb</code></em> color specified. This
value may be used to set the <em class="structfield"><code>pixel</code></em> field of
a <a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a> struct.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>rgb</code></em> :</span></td>
<td>The color, represented as a 0xRRGGBB integer value.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>The X pixel value.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2970681"></a><h3>
<a name="gdk-rgb-find-color"></a>gdk_rgb_find_color ()</h3>
<a class="indexterm" name="id2970694"></a><pre class="programlisting">void gdk_rgb_find_color (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap,
<a href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);</pre>
<p>
<em class="parameter"><code>colormap</code></em> should be the colormap for the graphics context and
drawable you're using to draw. If you're drawing to a <a
href="../gtk/GtkWidget.html"
><span class="type">GtkWidget</span></a>,
call <a
href="../gtk/GtkWidget.html#gtk-widget-get-colormap"
><code class="function">gtk_widget_get_colormap()</code></a>.
</p>
<p>
<em class="parameter"><code>color</code></em> should have its <code class="literal">red</code>, <code class="literal">green</code>, and <code class="literal">blue</code> fields initialized;
<a href="gdk-GdkRGB.html#gdk-rgb-find-color"><code class="function">gdk_rgb_find_color()</code></a> will fill in the <code class="literal">pixel</code> field with the best
matching pixel from a color cube. The color is then ready to be
used for drawing, e.g. you can call <a href="gdk-Graphics-Contexts.html#gdk-gc-set-foreground"><code class="function">gdk_gc_set_foreground()</code></a> which
expects <code class="literal">pixel</code> to be initialized.
</p>
<p>
In many cases, you can avoid this whole issue by calling
<a href="gdk-Graphics-Contexts.html#gdk-gc-set-rgb-fg-color"><code class="function">gdk_gc_set_rgb_fg_color()</code></a> or <a href="gdk-Graphics-Contexts.html#gdk-gc-set-rgb-bg-color"><code class="function">gdk_gc_set_rgb_bg_color()</code></a>, which
do not expect <code class="literal">pixel</code> to be initialized in advance. If you use those
functions, there's no need for <a href="gdk-GdkRGB.html#gdk-rgb-find-color"><code class="function">gdk_rgb_find_color()</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>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2970947"></a><h3>
<a name="gdk-rgb-set-install"></a>gdk_rgb_set_install ()</h3>
<a class="indexterm" name="id2970960"></a><pre class="programlisting">void gdk_rgb_set_install (<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> install);</pre>
<p>
If <em class="parameter"><code>install</code></em> is <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, directs GdkRGB to always install a new "private"
colormap rather than trying to find a best fit with the colors already
allocated. Ordinarily, GdkRGB will install a colormap only if a
sufficient cube cannot be allocated.
</p>
<p>
A private colormap has more colors, leading to better quality display,
but also leads to the dreaded "colormap flashing" effect.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>install</code></em> :</span></td>
<td>
<a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> to set install mode.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2971040"></a><h3>
<a name="gdk-rgb-set-min-colors"></a>gdk_rgb_set_min_colors ()</h3>
<a class="indexterm" name="id2971054"></a><pre class="programlisting">void gdk_rgb_set_min_colors (<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> min_colors);</pre>
<p>
Sets the minimum number of colors for the color cube. Generally,
GdkRGB tries to allocate the largest color cube it can. If it can't
allocate a color cube at least as large as <em class="parameter"><code>min_colors</code></em>, it installs a
private colormap.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>min_colors</code></em> :</span></td>
<td>The minimum number of colors accepted.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2971110"></a><h3>
<a name="gdk-rgb-get-visual"></a>gdk_rgb_get_visual ()</h3>
<a class="indexterm" name="id2971123"></a><pre class="programlisting"><a href="gdk-Visuals.html#GdkVisual">GdkVisual</a>* gdk_rgb_get_visual (void);</pre>
<p>
Gets a "preferred visual" chosen by GdkRGB for rendering image data
on the default screen. In previous versions of GDK, this was the
only visual GdkRGB could use for rendering. In current versions,
it's simply the visual GdkRGB would have chosen as the optimal one
in those previous versions. GdkRGB can now render to drawables with
any visual.</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 <a href="gdk-Visuals.html#GdkVisual"><span class="type">GdkVisual</span></a> chosen by GdkRGB.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2971176"></a><h3>
<a name="gdk-rgb-get-colormap"></a>gdk_rgb_get_colormap ()</h3>
<a class="indexterm" name="id2971188"></a><pre class="programlisting"><a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* gdk_rgb_get_colormap (void);</pre>
<p>
Get the preferred colormap for rendering image data. Not a
very useful function; historically, GDK could only render RGB image
data to one colormap and visual, but in the current version it can
render to any colormap and visual. So there's no need to call this
function.</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 preferred colormap
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2971232"></a><h3>
<a name="gdk-rgb-get-cmap"></a>gdk_rgb_get_cmap</h3>
<a class="indexterm" name="id2971247"></a><pre class="programlisting">#define gdk_rgb_get_cmap gdk_rgb_get_colormap
</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_rgb_get_cmap</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Gets the colormap set by GdkRGB. This colormap and the corresponding
visual should be used when creating windows that will be drawn in by GdkRGB.
</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 <a href="gdk-Colormaps-and-Colors.html#GdkColormap"><span class="type">GdkColormap</span></a> set by GdkRGB.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2971301"></a><h3>
<a name="gdk-rgb-ditherable"></a>gdk_rgb_ditherable ()</h3>
<a class="indexterm" name="id2971314"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gdk_rgb_ditherable (void);</pre>
<p>
Determines whether the preferred visual is ditherable. This function may be
useful for presenting a user interface choice to the user about which
dither mode is desired; if the display is not ditherable, it may make
sense to gray out or hide the corresponding UI widget.
</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>
<a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the preferred visual is ditherable.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2971364"></a><h3>
<a name="gdk-rgb-colormap-ditherable"></a>gdk_rgb_colormap_ditherable ()</h3>
<a class="indexterm" name="id2971378"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gdk_rgb_colormap_ditherable (<a href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *cmap);</pre>
<p>
Determines whether the visual associated with <em class="parameter"><code>cmap</code></em> is ditherable. This
function may be useful for presenting a user interface choice to the user
about which dither mode is desired; if the display is not ditherable, it may
make sense to gray out or hide the corresponding UI widget.
</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>
<a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the visual associated with <em class="parameter"><code>cmap</code></em> is ditherable.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2971468"></a><h3>
<a name="gdk-rgb-set-verbose"></a>gdk_rgb_set_verbose ()</h3>
<a class="indexterm" name="id2971481"></a><pre class="programlisting">void gdk_rgb_set_verbose (<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> verbose);</pre>
<p>
Sets the "verbose" flag. This is generally only useful for debugging.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>verbose</code></em> :</span></td>
<td>
<a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if verbose messages are desired.
</td>
</tr></tbody>
</table></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2971539"></a><h2>See Also</h2>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a href="gdk-Colormaps-and-Colors.html#GdkColor"><span class="type">GdkColor</span></a></span></td>
<td><p>The underlying GDK mechanism for allocating
colors.</p></td>
</tr>
<tr>
<td>
<span class="term"><a
href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
><span class="type">GdkPixbuf</span></a> and <a href="gdk-Pixbufs.html#gdk-pixbuf-render-to-drawable"><code class="function">gdk_pixbuf_render_to_drawable()</code></a></span></td>
<td><p>Higher-level image handling.</p></td>
</tr>
</tbody>
</table></div>
<p>
</p>
</div>
</div>
</body>
</html>