## go-color go-color |

## Synopsis

                        GONamedColor;
    #define             GDK_TO_UINT                         (c)
    #define             RGB_TO_UINT                         (r,g,b)
    #define             RGB_TO_RGBA                         (x,a)
    #define             RGB_WHITE
    #define             RGB_BLACK
    #define             RGB_RED
    #define             RGB_GREEN
    #define             RGB_BLUE
    #define             RGB_YELLOW
    #define             RGB_VIOLET
    #define             RGB_CYAN
    #define             RGB_GREY                            (x)
    #define             RGBA_TO_UINT                        (r,g,b,a)
    #define             RGBA_WHITE
    #define             RGBA_BLACK
    #define             RGBA_RED
    #define             RGBA_GREEN
    #define             RGBA_BLUE
    #define             RGBA_YELLOW
    #define             RGBA_VIOLET
    #define             RGBA_CYAN
    #define             RGBA_GREY                           (x)
    #define             UINT_RGBA_R                         (x)
    #define             UINT_RGBA_G                         (x)
    #define             UINT_RGBA_B                         (x)
    #define             UINT_RGBA_A                         (x)
    #define             UINT_RGBA_CHANGE_R                  (x, r)
    #define             UINT_RGBA_CHANGE_G                  (x, g)
    #define             UINT_RGBA_CHANGE_B                  (x, b)
    #define             UINT_RGBA_CHANGE_A                  (x, a)
    #define             UINT_TO_RGB                         (u,r,g,b)
    #define             UINT_TO_RGBA                        (u,r,g,b,a)
    #define             MONO_INTERPOLATE                    (v1, v2, t)
    #define             UINT_INTERPOLATE                    (c1, c2, t)
    #define             PIXEL_RGB                           (p, r, g, b)
    #define             PIXEL_RGBA                          (p, r, g, b, a)
    #define             PIXEL_RGB_UINT                      (p, i)
    #define             PIXEL_RGBA_UINT                     (p, i)
    #define             PIXEL_BLACK                         (p)
    #define             PIXEL_WHITE                         (p)
    #define             PIXEL_GREY                          (p,g)
    #define             PIXEL_GREYA                         (p,g,a)
    #define             DOUBLE_RGBA_R                       (x)
    #define             DOUBLE_RGBA_G                       (x)
    #define             DOUBLE_RGBA_B                       (x)
    #define             DOUBLE_RGBA_A                       (x)
    #define             GO_COLOR_TO_CAIRO                   (x)
    void                go_color_to_artpix                  (ArtPixMaxDepth *res,
                                                             GOColor rgba);
    void                go_color_render_svp                 (GOColor color,
                                                             ArtSVP const *svp,
                                                             int x0,
                                                             int y0,
                                                             int x1,
                                                             int y1,
                                                             art_u8 *buf,
                                                             int rowstride);
    gboolean            go_color_from_str                   (char const *str,
                                                             GOColor *res);
    gchar*              go_color_as_str                     (GOColor color);
    PangoAttribute*     go_color_to_pango                   (GOColor color,
                                                             gboolean is_fore);
    GdkColor*           go_color_to_gdk                     (GOColor color,
                                                             GdkColor *res);

## Description

## Details

### GONamedColor

    typedef struct {
    	GOColor		 color;
    	char const 	*name;	/* english name - eg. "white" */
    } GONamedColor;

### GDK_TO_UINT()

    #define GDK_TO_UINT(c)	RGBA_TO_UINT(((c).red>>8), ((c).green>>8), ((c).blue>>8), 0xff)

`c` : |

### RGB_TO_UINT()

    #define RGB_TO_UINT(r,g,b)	((((guint)(r))<<16)|(((guint)(g))<<8)|((guint)(b)))

`r` : |
`g` : |
`b` : |

### RGB_TO_RGBA()

    #define RGB_TO_RGBA(x,a)	(((x) << 8) | ((((guint)a) & 0xff)))

`x` : |
`a` : |

### RGB_WHITE

    #define RGB_WHITE   RGB_TO_UINT(0xff, 0xff, 0xff)

### RGB_BLACK

    #define RGB_BLACK   RGB_TO_UINT(0x00, 0x00, 0x00)

### RGB_RED

    #define RGB_RED     RGB_TO_UINT(0xff, 0x00, 0x00)

### RGB_GREEN

    #define RGB_GREEN   RGB_TO_UINT(0x00, 0xff, 0x00)

### RGB_BLUE

    #define RGB_BLUE    RGB_TO_UINT(0x00, 0x00, 0xff)

### RGB_YELLOW

    #define RGB_YELLOW  RGB_TO_UINT(0xff, 0xff, 0x00)

### RGB_VIOLET

    #define RGB_VIOLET  RGB_TO_UINT(0xff, 0x00, 0xff)

### RGB_CYAN

    #define RGB_CYAN    RGB_TO_UINT(0x00, 0xff, 0xff)

### RGB_GREY()

    #define RGB_GREY(x) RGB_TO_UINT(x,x,x)

`x` : |

### RGBA_TO_UINT()

    #define RGBA_TO_UINT(r,g,b,a)	((((guint)(r))<<24)|(((guint)(g))<<16)|(((guint)(b))<<8)|(guint)(a))

`r` : |
`g` : |
`b` : |
`a` : |

### RGBA_WHITE

    #define RGBA_WHITE  RGB_TO_RGBA(RGB_WHITE, 0xff)

### RGBA_BLACK

    #define RGBA_BLACK  RGB_TO_RGBA(RGB_BLACK, 0xff)

### RGBA_RED

    #define RGBA_RED    RGB_TO_RGBA(RGB_RED, 0xff)

### RGBA_GREEN

    #define RGBA_GREEN  RGB_TO_RGBA(RGB_GREEN, 0xff)

### RGBA_BLUE

    #define RGBA_BLUE   RGB_TO_RGBA(RGB_BLUE, 0xff)

### RGBA_YELLOW

    #define RGBA_YELLOW RGB_TO_RGBA(RGB_YELLOW, 0xff)

### RGBA_VIOLET

    #define RGBA_VIOLET RGB_TO_RGBA(RGB_VIOLET, 0xff)

### RGBA_CYAN

    #define RGBA_CYAN   RGB_TO_RGBA(RGB_CYAN, 0xff)

### RGBA_GREY()

    #define RGBA_GREY(x) RGB_TO_RGBA(RGB_GREY(x), 0xff)

`x` : |

### UINT_RGBA_R()

    #define UINT_RGBA_R(x) (((guint)(x))>>24)

`x` : |

### UINT_RGBA_G()

    #define UINT_RGBA_G(x) ((((guint)(x))>>16)&0xff)

`x` : |

### UINT_RGBA_B()

    #define UINT_RGBA_B(x) ((((guint)(x))>>8)&0xff)

`x` : |

### UINT_RGBA_A()

    #define UINT_RGBA_A(x) (((guint)(x))&0xff)

`x` : |

### UINT_RGBA_CHANGE_R()

    #define UINT_RGBA_CHANGE_R(x, r) (((x)&(~(0xff<<24)))|(((r)&0xff)<<24))

`x` : |
`r` : |

### UINT_RGBA_CHANGE_G()

    #define UINT_RGBA_CHANGE_G(x, g) (((x)&(~(0xff<<16)))|(((g)&0xff)<<16))

`x` : |
`g` : |

### UINT_RGBA_CHANGE_B()

    #define UINT_RGBA_CHANGE_B(x, b) (((x)&(~(0xff<<8)))|(((b)&0xff)<<8))

`x` : |
`b` : |

### UINT_RGBA_CHANGE_A()

    #define UINT_RGBA_CHANGE_A(x, a) (((x)&(~0xff))|((a)&0xff))

`x` : |
`a` : |

### UINT_TO_RGB()

    #define             UINT_TO_RGB(u,r,g,b)

`u` : |
`r` : |
`g` : |
`b` : |

### UINT_TO_RGBA()

    #define             UINT_TO_RGBA(u,r,g,b,a)

`u` : |
`r` : |
`g` : |
`b` : |
`a` : |

### MONO_INTERPOLATE()

    #define MONO_INTERPOLATE(v1, v2, t) ((gint)go_rint((v2)*(t)+(v1)*(1-(t))))

`v1` : |
`v2` : |
`t` : |

### UINT_INTERPOLATE()

    #define             UINT_INTERPOLATE(c1, c2, t)

`c1` : |
`c2` : |
`t` : |

### PIXEL_RGB()

    #define             PIXEL_RGB(p, r, g, b)

`p` : |
`r` : |
`g` : |
`b` : |

### PIXEL_RGBA()

    #define             PIXEL_RGBA(p, r, g, b, a)

`p` : |
`r` : |
`g` : |
`b` : |
`a` : |

### PIXEL_RGB_UINT()

    #define             PIXEL_RGB_UINT(p, i)

`p` : |
`i` : |

### PIXEL_RGBA_UINT()

    #define             PIXEL_RGBA_UINT(p, i)

`p` : |
`i` : |

### PIXEL_BLACK()

    #define PIXEL_BLACK(p) PIXEL_RGB(p,0,0,0)

`p` : |

### PIXEL_WHITE()

    #define PIXEL_WHITE(p) PIXEL_RGB(p,0xff,0xff,0xff)

`p` : |

### PIXEL_GREY()

    #define PIXEL_GREY(p,g) PIXEL_RGB(p,g,g,g)

`p` : |
`g` : |

### PIXEL_GREYA()

    #define PIXEL_GREYA(p,g,a) PIXEL_RGBA(p,g,g,g,a)

`p` : |
`g` : |
`a` : |

### DOUBLE_RGBA_R()

    #define DOUBLE_RGBA_R(x) (double)UINT_RGBA_R(x)/255.0

`x` : |

### DOUBLE_RGBA_G()

    #define DOUBLE_RGBA_G(x) (double)UINT_RGBA_G(x)/255.0

`x` : |

### DOUBLE_RGBA_B()

    #define DOUBLE_RGBA_B(x) (double)UINT_RGBA_B(x)/255.0

`x` : |

### DOUBLE_RGBA_A()

    #define DOUBLE_RGBA_A(x) (double)UINT_RGBA_A(x)/255.0

`x` : |

### GO_COLOR_TO_CAIRO()

    #define GO_COLOR_TO_CAIRO(x) DOUBLE_RGBA_R(x),DOUBLE_RGBA_G(x),DOUBLE_RGBA_B(x),DOUBLE_RGBA_A(x)

`x` : |

### go_color_to_artpix ()

    void                go_color_to_artpix                  (ArtPixMaxDepth *res,
                                                             GOColor rgba);

`res` : |
`rgba` : |

### go_color_render_svp ()

    void                go_color_render_svp                 (GOColor color,
                                                             ArtSVP const *svp,
                                                             int x0,
                                                             int y0,
                                                             int x1,
                                                             int y1,
                                                             art_u8 *buf,
                                                             int rowstride);

Renders the shape specified with `svp` over the `buf` RGB buffer. `x1` - `x0` specifies the width, and `y1` - `y0` specifies the height, of the rectangle rendered. The new pixels are stored starting at the first byte of `buf`. Thus, the `x0` and `y0` parameters specify an offset within `svp`, and may be tweaked as a way of doing integer-pixel translations without fiddling with `svp` itself.

The `color` argument specifies the color for the rendering. Pixels of entirely 0 winding number are left untouched. Pixels of entirely 1 winding number have the color `color` composited over them (ie, are replaced by the red, green, blue components of `color` if the alpha component is 0xff). Pixels of intermediate coverage are linearly interpolated.

`color` : | Color in 0xRRGGBBAA format.
`svp` : | The source sorted vector path.
`x0` : | Left coordinate of destination rectangle.
`y0` : | Top coordinate of destination rectangle.
`x1` : | Right coordinate of destination rectangle.
`y1` : | Bottom coordinate of destination rectangle.
`buf` : | Destination RGB buffer.
`rowstride` : | Rowstride of `buf` buffer.

### go_color_from_str ()

    gboolean            go_color_from_str                   (char const *str,
                                                             GOColor *res);

`str` : |
`res` : |
Returns : | TRUE if `str` can be parsed as a color of the form R:G:B:A and the result is stored in `res`.

### go_color_as_str ()

    gchar*              go_color_as_str                     (GOColor color);

`color` : |
Returns : |

### go_color_to_pango ()

    PangoAttribute*     go_color_to_pango                   (GOColor color,
                                                             gboolean is_fore);

`color` : |
`is_fore` : |
Returns : |

### go_color_to_gdk ()

    GdkColor*           go_color_to_gdk                     (GOColor color,
                                                             GdkColor *res);

`color` : |
`res` : |
Returns : |