Re: [gtk-list] what is the pixel value of the GdkColor ?



On Wed, 26 May 1999, Sven LUTHER wrote:


Hi !

> What is contained in the pixel value of the Gdkcolor type ?

It is pointer to color inside colormap. So you don't need to fill it. It
is automaticaly filled when you call gdk_colormap_alloc_color() function.

[...]

> /* is it necessary to put the color in a colrmap, or could i do without it ? */

Yes, if you want to do something with colors inside X, you need at first
allocate pixel in colormap.

> colormap = gdk_window_get_colormap ((GdkWindow *)pixmap) ;
>  /* what is the meaning of writeable and best_match ? */
> gdk_colormap_alloc_color (colormap, &color, writeable, best_match);

[...]

> Later when i want ot retrieve the color associated with a pixel of the pixmap,
> do i do :
> ----------------------------------------
> image = gdk_image_get ((GdkWindow *)pixmap, 0, 0, x+1, y+1);
> pixel = get_image_get_pixel (image, x, y);
> ----------------------------------------
> 
> how can i get back to the GdkColor value associated with said pixel.

easy way, how to do it :

	color = colormap->colors[pixel];

But, I hope that, there should be some function for it.

Bye,
Stevo.

---
Stefan Ondrejicka <ondrej@idata.sk>
Beethovenova 11, 917 08 Trnava, Slovakia
http://www.idata.sk/~ondrej/



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