3 * Copyright (C) 2002-2009 Jim Evins <evins@snaught.com>.
5 * This file is part of gLabels.
7 * gLabels is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * gLabels is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
30 * gLabels stores colors as a 32-bit unsigned integer in RGBA format (MSByte = Red)
32 #define GL_COLOR(r,g,b) ( (((unsigned int) (r) & 0xff) << 24) \
33 | (((unsigned int) (g) & 0xff) << 16) \
34 | (((unsigned int) (b) & 0xff) << 8) \
37 #define GL_COLOR_A(r,g,b,a) ( (((unsigned int) (r) & 0xff) << 24) \
38 | (((unsigned int) (g) & 0xff) << 16) \
39 | (((unsigned int) (b) & 0xff) << 8) \
40 | ( (unsigned int) (a) & 0xff ) )
43 #define GL_COLOR_NONE GL_COLOR_A(0,0,0,0)
44 #define GL_COLOR_BLACK GL_COLOR_A(0,0,0,255)
45 #define GL_COLOR_WHITE GL_COLOR_A(255,255,255,255)
47 #define GL_COLOR_TEXT_DEFAULT GL_COLOR_BLACK
48 #define GL_COLOR_BC_DEFAULT GL_COLOR_BLACK
49 #define GL_COLOR_NO_LINE GL_COLOR_NONE
50 #define GL_COLOR_NO_FILL GL_COLOR_NONE
51 #define GL_COLOR_FILL_MERGE_DEFAULT GL_COLOR_A(255,255,255,128)
52 #define GL_COLOR_MERGE_DEFAULT GL_COLOR_A(0,0,0,128)
53 #define GL_COLOR_SHADOW_DEFAULT GL_COLOR(0,0,0)
54 #define GL_COLOR_SHADOW_MERGE_DEFAULT GL_COLOR_A(0,0,0,255)
58 * Extract components as floating point (0.0 .. 1.0)
60 #define GL_COLOR_F_RED(x) ( (((x)>>24) & 0xff) / 255.0 )
61 #define GL_COLOR_F_GREEN(x) ( (((x)>>16) & 0xff) / 255.0 )
62 #define GL_COLOR_F_BLUE(x) ( (((x)>>8) & 0xff) / 255.0 )
63 #define GL_COLOR_F_ALPHA(x) ( ( (x) & 0xff) / 255.0 )
66 * Extract arguments for cairo_set_source_rgb()
68 #define GL_COLOR_RGB_ARGS(x) \
70 GL_COLOR_F_GREEN(x), \
74 * Extract arguments for cairo_set_source_rgba()
76 #define GL_COLOR_RGBA_ARGS(x) \
78 GL_COLOR_F_GREEN(x), \
85 guint gl_color_set_opacity (guint color,
88 guint gl_color_shadow (guint base_color,
93 * Routines to convert to/from GdkColor.
95 GdkColor *gl_color_to_gdk_color (guint color);
97 guint gl_color_from_gdk_color (GdkColor *gdk_color);
110 glColorNode *gl_color_node_new_default (void);
112 glColorNode *gl_color_node_dup (glColorNode *color_node);
113 gboolean gl_color_node_equal (glColorNode *color_node1,
114 glColorNode *color_node2);
115 guint gl_color_node_expand (glColorNode *color_node,
116 glMergeRecord *record);
117 void gl_color_node_free (glColorNode **color_node);
122 #endif /* __COLOR_H__ */
127 * Local Variables: -- emacs
129 * c-basic-offset: 8 -- emacs
130 * tab-width: 8 -- emacs
131 * indent-tabs-mode: nil -- emacs