1 /* Libvisual - The audio visualisation framework.
2  *
3  * Copyright (C) 2004, 2005 Dennis Smit <ds@nerds-incorporated.org>
4  *
5  * Authors: Dennis Smit <ds@nerds-incorporated.org>
6  *
7  * $Id:
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License as
11  * published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */
23 
24 #ifndef _LV_COLOR_H
25 #define _LV_COLOR_H
26 
27 #include <libvisual/lv_common.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32 
33 #define VISUAL_COLOR(obj)				(VISUAL_CHECK_CAST ((obj), 0, VisColor))
34 
35 typedef struct _VisColor VisColor;
36 
37 /**
38  * Data type to describe a palette entry, or a color. The HSV isn't kept in sync with RGB automaticly
39  * but it's there especially for VisUI.
40  */
41 struct _VisColor {
42 	VisObject	object;	/**< The VisObject data. */
43 	uint8_t		r;	/**< The red channel of this VisColor. */
44 	uint8_t		g;	/**< The green channel of this VisColor. */
45 	uint8_t		b;	/**< The blue channel of this VisColor. */
46 	uint8_t		unused;	/**< Unused. */
47 };
48 
49 VisColor *visual_color_new (void);
50 int visual_color_compare (VisColor *src1, VisColor *src2);
51 int visual_color_from_hsv (VisColor *color, float h, float s, float v);
52 int visual_color_to_hsv (VisColor *color, float *h, float *s, float *v);
53 int visual_color_copy (VisColor *dest, VisColor *src);
54 
55 #ifdef __cplusplus
56 }
57 #endif /* __cplusplus */
58 
59 #endif /* _LV_COLOR_H */
60