> I think my question is:
>   If I have an image loaded into gimp, and displayed in a window, and my
>   plug-in fired up, how do I get the coordinates of the mouse when one of
>   the buttons is clicked into the plug-in?
> Here's what I want to do:
>   I'm trying to write an "unplot" plugin.  The idea is to load a graph
>   image into the gimp (probably using a scanner), and then, using the mouse
>   to click on points on the graph, write the x and y values of
>   mouse-selected points to a file.  Thus, if I had a graph of, say,
>   voltage vs. current, I could digitize it manually using the plug-in,
>   obtaining a file with voltages and currents.
> In order to do this, the plug-in has to be able to get the mouse
> coordinates when a button is clicked.  I think I know how to do that in
> a stand-alone gtk-based program, but I can't figure out how to do it
> from a gimp plug-in.  I guess the optimum coordinate system would be the
> local coordinates within the image window, but global coordinates of the
> underlying root window would probably be OK too.
> Advice would be much appreciated.  I've looked in Kevin Turner's "Writing
> a GIMP Plug-in" tutorial, and in all the FAQ's I can find.  I've also
> looked in the plug-in registry for an existing plug-in I could snarf.  If
> the solution was in any of these places, I was too dense to realize it.

Well, the answer is that you can't! There is no way for a plug-in to 
notice what a user is doing in the image window. 

The only possibility you have is to ask gimp for a preview of the image
using gimp_image_get_thumbnail() or the complete image data using 
gimp_pixel_rgn_init() and friends, then render that image into your own 
GtkDrawingArea or GtkPreview and connect to the events they emit. 

Salut, Sven

Reply via email to