I'm a novice at working with the gimp, and I'm trying to write a
plug-in. I've run into an unexpected snag, and I would very much
appreciate a little help. I'll start with what I think my question is,
and then afterwards, briefly describe what I want to do in case that
really isn't my question :-).
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.
Department of Electrical Engineering
University of Nebraska-Lincoln
Lincoln, NE 68588-0511