## RGBA Colors RGBA Colors — RGBA colors |

## Synopsis

    #include <gdk/gdk.h>

                        GdkRGBA;
    GdkRGBA *           gdk_rgba_copy                       (GdkRGBA *rgba);
    void                gdk_rgba_free                       (GdkRGBA *rgba);
    gboolean            gdk_rgba_parse                      (const gchar *spec,
                                                             GdkRGBA *rgba);
    gboolean            gdk_rgba_equal                      (gconstpointer p1,
                                                             gconstpointer p2);
    guint               gdk_rgba_hash                       (gconstpointer p);
    gchar *             gdk_rgba_to_string                  (const GdkRGBA *rgba);

## Description

## Details

### GdkRGBA

    typedef struct {
      gdouble red;
      gdouble green;
      gdouble blue;
      gdouble alpha;
    } GdkRGBA;

### gdk_rgba_copy ()

    GdkRGBA *           gdk_rgba_copy                       (GdkRGBA *rgba);

Makes a copy of a GdkRGBA structure, the result must be freed through `gdk_rgba_free()`.

`rgba` : | a GdkRGBA
Returns : | A newly allocated GdkRGBA

### gdk_rgba_free ()

    void                gdk_rgba_free                       (GdkRGBA *rgba);

Frees a GdkRGBA struct created with `gdk_rgba_copy()`

`rgba` : | a GdkRGBA

### gdk_rgba_parse ()

    gboolean            gdk_rgba_parse                      (const gchar *spec,
                                                             GdkRGBA *rgba);

Parses a textual representation of a color, filling in the `red`, `green`, `blue` and `alpha` fields of the `rgba` struct.

The string can be either one of:

- A standard name (Taken from the X11 rgb.txt file).
- A hex value in the form 'rgb' 'rrggbb' 'rrrgggbbb' or 'rrrrggggbbbb'
- A RGB color in the form 'rgb(r,g,b)' (In this case the color will have full opacity)
- A RGBA color in the form 'rgba(r,g,b,a)'

Where 'r', 'g', 'b' and 'a' are respectively the red, green, blue and alpha color values. In the last two cases, r g and b are either integers in the range 0 to 255 or precentage values in the range 0% to 100%, and a is a floating point value in the range 0 to 1.

`spec` : | the string specifying the color
`rgba` : | the GdkRGBA struct to fill in
Returns : | `TRUE` if the parsing succeeded

### gdk_rgba_equal ()

    gboolean            gdk_rgba_equal                      (gconstpointer p1,
                                                             gconstpointer p2);

Compares two RGBA colors.

`p1` : | a GdkRGBA pointer.
`p2` : | another GdkRGBA pointer.
Returns : | `TRUE` if the two colors compare equal

### gdk_rgba_hash ()

    guint               gdk_rgba_hash                       (gconstpointer p);

A hash function suitable for using for a hash table that stores GdkRGBAs.

`p` : | a GdkRGBA pointer.
Returns : | The hash function applied to `p`

### gdk_rgba_to_string ()

    gchar *             gdk_rgba_to_string                  (const GdkRGBA *rgba);

Returns a textual specification of `rgba` in the form `rgb (r, g, b)` or `rgba (r, g, b, a)`, where 'r', 'g', 'b' and 'a' represent the red, green, blue and alpha values respectively. r, g, and b are integers in the range 0 to 255, and a is a floating point value in the range 0 to 1.

(These string forms are string forms those supported by the CSS3 colors module)

`rgba` : | a GdkRGBA
Returns : | A newly allocated text string