[gtkada] Getting the color of one point ?

Emmanuel Briot briot at adacore.com
Tue Jun 14 14:54:40 CEST 2005



Jeremy Berthet wrote:
> I'm actually using a gdk_pixmap to draw on and a gtk_drawing_area to
> render it.
> 
> I have been looking, without any success, for a method to obtain the
> color of one point (pixel) at a specific position either on the pixmap
> or the drawing area.


I don't think you can do that with a gtk_drawing_area. This is a 
server-side pixmap (like a Gdk_Pixmap, in fact), and requesting the 
color of one pixel requires a round-trip to the server.
Have a look at either Gdk_Image/Gtk_Image, which is a client_side 
drawing area, or even a a Gdk_Pixbuf/Gdk_RGB, which seems to be what 
gtk+ itself uses when you load a jpg file for instance.
I don't have much on the technical details, though, so you should also 
investigate the C toolkit and mailing list and see how people do this in 
C. The mapping in Ada should be pretty straightforward after that.

regards,
Emmanuel



More information about the gtkada mailing list