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