gdk_color_context_get_pixels() -> ... ?



Hi guys,

there's the following code in gnome-libs HEAD:

----
int
gnome_canvas_get_color (GnomeCanvas *canvas, const char *spec, GdkColor *color)
{
	gulong pixel;
	gint n;

	g_return_val_if_fail (canvas != NULL, FALSE);
	g_return_val_if_fail (GNOME_IS_CANVAS (canvas), FALSE);
	g_return_val_if_fail (color != NULL, FALSE);

	if (!spec) {
		color->pixel = 0;
		color->red = 0;
		color->green = 0;
		color->blue = 0;
		return FALSE;
	}

	gdk_color_parse (spec, color);

	pixel = 0;
	n = 0;
	gdk_color_context_get_pixels (canvas->cc,
				      &color->red,
				      &color->green,
				      &color->blue,
				      1,
				      &pixel,
				      &n);

	color->pixel = pixel;

	return TRUE;
}

gulong
gnome_canvas_get_color_pixel (GnomeCanvas *canvas,
			      guint        rgba)
{
	GdkColor color;
	gulong pixel;
	gint n;

	g_return_val_if_fail (GNOME_IS_CANVAS (canvas), 0);

	color.red = ((rgba & 0xff000000) >> 16) + ((rgba & 0xff000000) >> 24);
	color.green = ((rgba & 0x00ff0000) >> 8) + ((rgba & 0x00ff0000) >> 16);
	color.blue = (rgba & 0x0000ff00) + ((rgba & 0x0000ff00) >> 8);
	pixel = 0;
	n = 0;
	gdk_color_context_get_pixels (canvas->cc,
				      &color.red,
				      &color.green,
				      &color.blue,
				      1,
				      &pixel,
				      &n);

	return pixel;
}
---

Unfortunately, I don't have any idea how to rewrite them now that
GdkColorContext is gone; can someone of you please help me with this ?

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]