On Tue, 27 Jun 2000, Frazer Williams wrote:
> 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?
thats a gtk question, which is nicely answered at http://www.gtk.org look
at the gtk tutorial (which can be downloaded). then look at events.
> 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.
you could "detect" the plots automatically and with a little logic in your
code, get an approximate of the plots. maybe even something as simple as a
threshold then average those remaining values. this could be pretty
elaborate and thus possible end up taking more of your time than the plug
in you want to write would save you (but could be fun)
> 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.
most gimp plug ins are gtk programs. they just happend to be called from
the gimp and share some resourcces (i have written a gimp plug in with
glut, and it worked, but gtk is usually easier) the same method should