1/* $Id$ $Revision$ */
2/* vim:set shiftwidth=4 ts=8: */
3
4/*************************************************************************
5 * Copyright (c) 2011 AT&T Intellectual Property
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of the Eclipse Public License v1.0
8 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *
11 * Contributors: See CVS logs. Details at http://www.graphviz.org/
12 *************************************************************************/
13
14#ifndef GV_COLOR_H
15#define GV_COLOR_H
16
17/* #include "arith.h" */
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23typedef struct hsvrgbacolor_t {
24 char *name;
25 unsigned char h, s, v;
26 unsigned char r, g, b, a;
27} hsvrgbacolor_t;
28
29/* possible representations of color in gvcolor_t */
30typedef enum { HSVA_DOUBLE, RGBA_BYTE, RGBA_WORD, CMYK_BYTE,
31 RGBA_DOUBLE, COLOR_STRING, COLOR_INDEX } color_type_t;
32
33/* gvcolor_t can hold a color spec in a choice or representations */
34typedef struct color_s {
35 union {
36 double RGBA[4];
37 double HSVA[4];
38 unsigned char rgba[4];
39 unsigned char cmyk[4];
40 int rrggbbaa[4];
41 char *string;
42 int index;
43 } u;
44 color_type_t type;
45} gvcolor_t;
46
47#define COLOR_MALLOC_FAIL -1
48#define COLOR_UNKNOWN 1
49#define COLOR_OK 0
50
51#ifdef __cplusplus
52}
53#endif
54#endif
55