GdkRGB: GDK 2 Reference Manual

## GdkRGB GdkRGB |

## Functions

void | gdk_rgb_init ()
void | gdk_draw_rgb_image ()
void | gdk_draw_rgb_image_dithalign ()
void | gdk_draw_indexed_image ()
void | gdk_draw_gray_image ()
void | gdk_draw_rgb_32_image ()
void | gdk_draw_rgb_32_image_dithalign ()
GdkRgbCmap * | gdk_rgb_cmap_new ()
void | gdk_rgb_cmap_free ()
void | gdk_rgb_gc_set_foreground ()
void | gdk_rgb_gc_set_background ()
gulong | gdk_rgb_xpixel_from_rgb ()
void | gdk_rgb_find_color ()
void | gdk_rgb_set_install ()
void | gdk_rgb_set_min_colors ()
GdkVisual * | gdk_rgb_get_visual ()
GdkColormap * | gdk_rgb_get_colormap ()
gboolean | gdk_rgb_ditherable ()
gboolean | gdk_rgb_colormap_ditherable ()
void | gdk_rgb_set_verbose ()

## Types and Values

enum | GdkRgbDither
struct | GdkRgbCmap
#define | gdk_rgb_get_cmap

## Includes

    #include <gdk/gdk.h>

## Description

## Functions

### gdk_rgb_init ()

    void
    gdk_rgb_init (void);

`gdk_rgb_init` is deprecated and should not be used in newly-written code.

### gdk_draw_rgb_image ()

    void
    gdk_draw_rgb_image (GdkDrawable *drawable,
                        GdkGC *gc,
                        gint x,
                        gint y,
                        gint width,
                        gint height,
                        GdkRgbDither dith,
                        const guchar *rgb_buf,
                        gint rowstride);

`gdk_draw_rgb_image` is deprecated and should not be used in newly-written code.

### gdk_draw_rgb_image_dithalign ()

    void
    gdk_draw_rgb_image_dithalign (GdkDrawable *drawable,
                                  GdkGC *gc,
                                  gint x,
                                  gint y,
                                  gint width,
                                  gint height,
                                  GdkRgbDither dith,
                                  const guchar *rgb_buf,
                                  gint rowstride,
                                  gint xdith,
                                  gint ydith);

`gdk_draw_rgb_image_dithalign` is deprecated and should not be used in newly-written code.

### gdk_draw_indexed_image ()

    void
    gdk_draw_indexed_image (GdkDrawable *drawable,
                            GdkGC *gc,
                            gint x,
                            gint y,
                            gint width,
                            gint height,
                            GdkRgbDither dith,
                            const guchar *buf,
                            gint rowstride,
                            GdkRgbCmap *cmap);

`gdk_draw_indexed_image` is deprecated and should not be used in newly-written code.

### gdk_draw_gray_image ()

    void
    gdk_draw_gray_image (GdkDrawable *drawable,
                         GdkGC *gc,
                         gint x,
                         gint y,
                         gint width,
                         gint height,
                         GdkRgbDither dith,
                         const guchar *buf,
                         gint rowstride);

`gdk_draw_gray_image` is deprecated and should not be used in newly-written code.

### gdk_draw_rgb_32_image ()

    void
    gdk_draw_rgb_32_image (GdkDrawable *drawable,
                           GdkGC *gc,
                           gint x,
                           gint y,
                           gint width,
                           gint height,
                           GdkRgbDither dith,
                           const guchar *buf,
                           gint rowstride);

`gdk_draw_rgb_32_image` is deprecated and should not be used in newly-written code.

### gdk_draw_rgb_32_image_dithalign ()

    void
    gdk_draw_rgb_32_image_dithalign (GdkDrawable *drawable,
                                     GdkGC *gc,
                                     gint x,
                                     gint y,
                                     gint width,
                                     gint height,
                                     GdkRgbDither dith,
                                     const guchar *buf,
                                     gint rowstride,
                                     gint xdith,
                                     gint ydith);

`gdk_draw_rgb_32_image_dithalign` has been deprecated since version 2.22 and should not be used in newly-written code.

Cairo handles colors automatically.

Like `gdk_draw_rgb_32_image()`, but allows you to specify the dither offsets. See `gdk_draw_rgb_image_dithalign()` for more details.

#### Parameters

drawable | a GdkDrawable |
gc | a GdkGC |
x | X coordinate on `drawable` where image should go |
y | Y coordinate on `drawable` where image should go |
width | width of area of image to draw |
height | height of area of image to draw |
dith | dithering mode |
buf | RGB image data |
rowstride | rowstride of RGB image data |
xdith | X dither offset |
ydith | Y dither offset |

### gdk_rgb_cmap_new ()

    GdkRgbCmap *
    gdk_rgb_cmap_new (guint32 *colors,
                      gint n_colors);

`gdk_rgb_cmap_new` is deprecated and should not be used in newly-written code.

### gdk_rgb_cmap_free ()

    void
    gdk_rgb_cmap_free (GdkRgbCmap *cmap);

`gdk_rgb_cmap_free` is deprecated and should not be used in newly-written code.

### gdk_rgb_gc_set_foreground ()

    void
    gdk_rgb_gc_set_foreground (GdkGC *gc,
                               guint32 rgb);

`gdk_rgb_gc_set_foreground` is deprecated and should not be used in newly-written code.

### gdk_rgb_gc_set_background ()

    void
    gdk_rgb_gc_set_background (GdkGC *gc,
                               guint32 rgb);

`gdk_rgb_gc_set_background` is deprecated and should not be used in newly-written code.

### gdk_rgb_xpixel_from_rgb ()

    gulong
    gdk_rgb_xpixel_from_rgb (guint32 rgb);

`gdk_rgb_xpixel_from_rgb` is deprecated and should not be used in newly-written code.

### gdk_rgb_find_color ()

    void
    gdk_rgb_find_color (GdkColormap *colormap,
                        GdkColor *color);

`gdk_rgb_find_color` has been deprecated since version 2.22 and should not be used in newly-written code.

Cairo handles colors automatically.

`colormap` should be the colormap for the graphics context and drawable you're using to draw. If you're drawing to a GtkWidget, call `gtk_widget_get_colormap()`.

`color` should have its `red`, `green`, and `blue` fields initialized; `gdk_rgb_find_color()` will fill in the `pixel` 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 `gdk_gc_set_foreground()` which expects `pixel` to be initialized.

In many cases, you can avoid this whole issue by calling `gdk_gc_set_rgb_fg_color()` or `gdk_gc_set_rgb_bg_color()`, which do not expect `pixel` to be initialized in advance. If you use those functions, there's no need for `gdk_rgb_find_color()`.

#### Parameters

colormap | a GdkColormap |
color | a GdkColor |

### gdk_rgb_set_install ()

    void
    gdk_rgb_set_install (gboolean install);

`gdk_rgb_set_install` is deprecated and should not be used in newly-written code.

### gdk_rgb_set_min_colors ()

    void
    gdk_rgb_set_min_colors (gint min_colors);

`gdk_rgb_set_min_colors` is deprecated and should not be used in newly-written code.

### gdk_rgb_get_visual ()

    GdkVisual *
    gdk_rgb_get_visual (void);

`gdk_rgb_get_visual` has been deprecated since version 2.22 and should not be used in newly-written code.

Use gdk_visual_get_system_visual (`gdk_screen_get_default()`) instead.

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.

#### Returns

The GdkVisual chosen by GdkRGB.

[transfer none]

### gdk_rgb_get_colormap ()

    GdkColormap *
    gdk_rgb_get_colormap (void);

`gdk_rgb_get_colormap` has been deprecated since version 2.22 and should not be used in newly-written code.

Use gdk_screen_get_system_colormap (`gdk_screen_get_default()`) instead.

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.

#### Returns

the preferred colormap.

[transfer none]

### gdk_rgb_ditherable ()

    gboolean
    gdk_rgb_ditherable (void);

`gdk_rgb_ditherable` is deprecated and should not be used in newly-written code.

### gdk_rgb_colormap_ditherable ()

    gboolean
    gdk_rgb_colormap_ditherable (GdkColormap *cmap);

`gdk_rgb_colormap_ditherable` is deprecated and should not be used in newly-written code.

### gdk_rgb_set_verbose ()

    void
    gdk_rgb_set_verbose (gboolean verbose);

`gdk_rgb_set_verbose` is deprecated and should not be used in newly-written code.

## Types and Values

### enum GdkRgbDither

#### Members

GDK_RGB_DITHER_NONE |  |
GDK_RGB_DITHER_NORMAL |  |
GDK_RGB_DITHER_MAX |  |

### struct GdkRgbCmap

    struct GdkRgbCmap {
      guint32 colors[256];
      gint n_colors;
    };

`GdkRgbCmap` is deprecated and should not be used in newly-written code.

### gdk_rgb_get_cmap

    #define gdk_rgb_get_cmap               gdk_rgb_get_colormap

`gdk_rgb_get_cmap` is deprecated and should not be used in newly-written code.