[gtkada] get the color of drawing_area' pixel

Preben Randhol randhol at pvv.org
Sun May 19 20:13:39 CEST 2002


yoann.toussaint at free.fr wrote on 19/05/2002 (19:30) :
> sorry to rewrite my question, but for four days I am revolving this problem...
> to make my paint'like, I have to get the gdk_color on a drawing area at 
> coordinates x,y. how to get this ?
> and why the gdk_color type is a record of values RGB AND a pixel type ?
> 
> please help me !

I'm sorry, but I have never done this so I'm not sure how to do it.

But looking in the manual and on the net a bit I see:

Package Gtk.Image
*****************

The Gtk_Image widget displays a graphical image. The image is typically
created using Gdk.Image.Gdk_New.

   The pixels in a Gtk_Image may be manipulated by the application after
   creation, as Gtk_Image store the pixel data on the client side. If
   you wish  to store the pixel data on the server side (thus not
   allowing manipulation  of the data after creation) you should use
   Gtk_Pixmap.


For the net I found:

   gdk_draw_point will draw a pixel. "gdk_draw_?" for all drawing stuff.

   To get a pixel you end up dealing with the whole X windows thing.
   gdk_draw_point draws on a pixmap and a pixmap is a server side thing,
   meaning you do not have access to the pixmap data. That is what a
   "image" all about. You can "get" a pixmap into an image and then use
   the image functions. The image is client side data and the data is in
   device and mode dependent format. Each mode, and or video card could
   be different. No something you want to deal with.

   You might look into GdkRgb. It is basically a client side RGB buffer
   which can be rendered directly to any GdkDrawable. GdkRgb does not
   have any drawing primitives for you to use. It's all up to you.

More than this I don't now. Try search a bit on the net or ask on GTK+
mailinglist.


-- 
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
                 «For me, Ada95 puts back the joy in programming.»




More information about the gtkada mailing list