44 static int color_inited;
47 GdkRGBA gn_white, gn_black, gn_light_gray;
48 GdkRGBA gn_dark_gray, gn_blue, gn_red, gn_yellow;
50 static GHashTable *color_hash_table = NULL;
53 color_hash (gconstpointer v)
55 const guint32 *c = (guint32 *) v;
62 color_equal (gconstpointer v, gconstpointer w)
64 const guint32 *c1 = (guint32 *) v;
65 const guint32 *c2 = (guint32 *) w;
79 const guint32 key = argb;
82 color = g_hash_table_lookup (color_hash_table, &key);
87 color = g_new0(GdkRGBA, 1);
88 newkey = g_new0(guint32, 1);
92 color->red = ((argb & 0xff0000) >> 8)/ 65535.0;
93 color->green = (argb & 0xff00) / 65535.0;
94 color->blue = ((argb & 0xff) << 8) / 65535.0;
97 g_hash_table_insert (color_hash_table, newkey, color);
104 gnucash_color_init (
void)
107 gdk_rgba_parse (&gn_white,
"white");
108 gdk_rgba_parse (&gn_black,
"black");
110 gdk_rgba_parse (&gn_light_gray,
"gray60");
111 gdk_rgba_parse (&gn_dark_gray,
"gray40");
112 gdk_rgba_parse (&gn_blue,
"blue");
113 gdk_rgba_parse (&gn_red,
"red");
114 gdk_rgba_parse (&gn_yellow,
"yellow");
116 if (!color_hash_table)
117 color_hash_table = g_hash_table_new (color_hash, color_equal);
Convenience wrapper around GdkRGBA for use in Register Gnome classes.
GdkRGBA * gnucash_color_argb_to_gdk(guint32 argb)
Return the pixel value for the given red, green and blue.