Re: [gtk-list] what is the pixel value of the GdkColor ?
- From: Sven LUTHER <luther maxime u-strasbg fr>
- To: Stefan Ondrejicka <ondrej idata sk>, luther dpt-info u-strasbg fr
- Cc: GTK mailing list <gtk-list redhat com>
- Subject: Re: [gtk-list] what is the pixel value of the GdkColor ?
- Date: Wed, 26 May 1999 16:27:28 +0200
On Wed, May 26, 1999 at 04:29:06PM +0200, Stefan Ondrejicka wrote:
> 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.
Ok, that is what i guessed ...
>
> [...]
>
> > /* 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.
In my case, i am writting a binding for ocaml, an ml style language and what
you just described is quite un-nice. a :
Gdkcolor gdk_colormap_get_pixel_color (GdkColormap colormap, gunit32 pixel)
would be very nice,
Friendly,
Sven LUTHER
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]