| 1 | /* |
| 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | * |
| 6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _COLOR_H |
| 10 | #define _COLOR_H |
| 11 | typedef unsigned int color; |
| 12 | |
| 13 | mal_export str CLRstr(str *val, const color *c); |
| 14 | mal_export str CLRcolor(color *c, const char **val); |
| 15 | mal_export str CLRred(int *r, const color *c); |
| 16 | mal_export str CLRgreen(int *g, const color *c); |
| 17 | mal_export str CLRblue(int *b, const color *c); |
| 18 | mal_export str CLRhue(flt *r, const color *c); |
| 19 | mal_export str CLRsaturation(flt *g, const color *c); |
| 20 | mal_export str CLRvalue(flt *b, const color *c); |
| 21 | mal_export str CLRhueInt(int *r, const color *c); |
| 22 | mal_export str CLRsaturationInt(int *g, const color *c); |
| 23 | mal_export str CLRvalueInt(int *b, const color *c); |
| 24 | mal_export str CLRluminance(int *r, const color *c); |
| 25 | mal_export str CLRcr(int *r, const color *c); |
| 26 | mal_export str CLRcb(int *g, const color *c); |
| 27 | mal_export str CLRhsv(color *c, const flt *h, const flt *s, const flt *v); |
| 28 | mal_export str CLRrgb(color *rgb, const int *r, const int *g, const int *b); |
| 29 | mal_export str CLRycc(color *c, const int *y, const int *cr, const int *cb); |
| 30 | mal_export ssize_t color_fromstr(const char *colorStr, size_t *len, color **c, bool external); |
| 31 | mal_export ssize_t color_tostr(char **colorStr, size_t *len, const color *c, bool external); |
| 32 | |
| 33 | #define color_nil ((color)int_nil) |
| 34 | #define is_color_nil(v) is_int_nil((int) (v)) |
| 35 | |
| 36 | #endif |
| 37 | |