RSS/Atom feed Twitter
Site is read-only, email is disabled

Mouse Coordinates for gimp Script or Plug-in

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

Fw: [Gimp-user] Mouse Coordinates for gimp Script or Plug-in Kevin Myers 14 Oct 20:36
Mouse Coordinates for gimp Script or Plug-in Kevin Myers 16 Oct 03:18
  Mouse Coordinates for gimp Script or Plug-in Michael J. Hammel 16 Oct 04:02
Mouse Coordinates for gimp Script or Plug-in Kevin Myers 16 Oct 05:15
Kevin Myers
2002-10-14 20:36:58 UTC (over 21 years ago)

Fw: [Gimp-user] Mouse Coordinates for gimp Script or Plug-in

----- Original Message -----
From: "Kevin Myers"
To: "gimp users"
Sent: Monday, October 14, 2002 9:16 AM Subject: [Gimp-user] Mouse Coordinates for gimp Script or Plug-in

Hello,

I would like to develop some gimp scripts and/or plug-ins where I need to obtain the coordinates from a user's mouse click within the image. This might preferably be the image coordinates of the mouse when the user right clicked to get the pop-up menu, or could instead perhaps be in response to

a

request to click within the image from the script or plug-in.

The scripts that I would like to develop are related to automatic

digitizing

of values from scanned images of hardcopy documents. It's critical that

the

user be able to click within the image to identify the points that are needed to translate raw image coordinates into the coordinate system that they are working in.

Does anyone out there know if/how there is any way to obtain the

coordinates

of a mouse click via a gimp script or plug-in? If this can be done, then

I

believe that it would allow gimp to serve as the basis for a number of

power

image analysis tools that require user specification of image coordinates.

Thanks in advance for any help!

Kevin M. Round Rock, Texas

Kevin Myers
2002-10-16 03:18:16 UTC (over 21 years ago)

Mouse Coordinates for gimp Script or Plug-in

Hi folks -

The other day I sent the following message to both the gimp users and gimp developers lists, hoping to determine whether there is any way to obtain image coordinates from a mouse click in a gimp plug-in. So far I haven't received a single reply. Are there really any of you out there??? :-) Even if you don't know or can't answer my question, it might be nice to receive a few replies anyway so I can at least confirm that my message actually got through ok.

If there is presently no way for a gimp plug-in to obtain mouse click image coordinates (either at point of menu invocation or later), then I would like to submit this as a suggestion to be considered for a future release.

Thanks. s/KAM

----- Original Message -----
From: "Kevin Myers"
To: "gimp users"
Sent: Monday, October 14, 2002 9:16 AM Subject: [Gimp-user] Mouse Coordinates for gimp Script or Plug-in

Hello,

I would like to develop some gimp scripts and/or plug-ins where I need

to

obtain the coordinates from a user's mouse click within the image. This might preferably be the image coordinates of the mouse when the user

right

clicked to get the pop-up menu, or could instead perhaps be in response

to

a

request to click within the image from the script or plug-in.

The scripts that I would like to develop are related to automatic

digitizing

of values from scanned images of hardcopy documents. It's critical that

the

user be able to click within the image to identify the points that are needed to translate raw image coordinates into the coordinate system

that

they are working in.

Does anyone out there know if/how there is any way to obtain the

coordinates

of a mouse click via a gimp script or plug-in? If this can be done,

then

I

believe that it would allow gimp to serve as the basis for a number of

power

image analysis tools that require user specification of image

coordinates.

Thanks in advance for any help!

Kevin M. Round Rock, Texas

Michael J. Hammel
2002-10-16 04:02:48 UTC (over 21 years ago)

Mouse Coordinates for gimp Script or Plug-in

Thus spoke Kevin Myers

The other day I sent the following message to both the gimp users and gimp developers lists, hoping to determine whether there is any way to obtain image coordinates from a mouse click in a gimp plug-in. So far I haven't received a single reply. Are there really any of you out there??? :-) Even if you don't know or can't answer my question, it might be nice to receive a few replies anyway so I can at least confirm that my message actually got through ok.

The developers are here. Probably just busy. :-) I saw you're message the other day but didn't have time to look into it.

If there is presently no way for a gimp plug-in to obtain mouse click image coordinates (either at point of menu invocation or later), then I would like to submit this as a suggestion to be considered for a future release.

I'm not aware of a way to get the mouse coordinates from a mouse click in a canvas window over to the plug-in. Normally, plug-ins will copy the drawable (layer, selection, or whatever) into their own space to work on it, and translate their (possibly) scaled version's coordinates into those on the canvas. While not optimal, it should work for you.

The problem, as I see it, is that the communications channel between the GIMP and plug-ins is not event driven but rather function driven - you must invoke an API call to communicate with the GIMP. Actually, I don't think of that as a problem. It's just the way things work. At least from what I know.

One way around this - which would probably be an ugly hack - would be to have the GIMP save the click location for a canvas and let the plug-in query for that location. It might be similar to a one-pixel selection. Might be a problem in knowing when a click is supposed to set that location and when it's supposed to be applied to the currently active tool.

Anyway, it's just a thought. For now, you need to copy the drawable into your space to get coordinates via a preview window.

BTW, if anyone is interested, I've updated Shawn Amundson's preview widget and put it into a Glade-based template plug-in. That might be helpful as a start for you. Or maybe not. It's still a work in progress to make it a very useful template. Needs documentation, etc. But you can use Glade to edit the interface.

http://www.graphics-muse.org/source/gfxmuse.tar.gz

It's imake based 'cuz I know imake, not autoconf.

Kevin Myers
2002-10-16 05:15:29 UTC (over 21 years ago)

Mouse Coordinates for gimp Script or Plug-in

Hi Mike -

Thanks a lot for your reply!

I really don't want to have to deal with a separate preview window. The images that I deal with are huge, and that would just consume even more memory and desktop space, and make the application that I envision seem to be even less "integrated".

An "ugly hack" similar to what you suggested could work for my needs. A similar solution might be to provide the coordinates of the mouse click directly through the standard API calls to the plug-in. I don't know if that would require any substantial changes to the API, but obviously that would be undesirable if so. In any case, the hack that you mentioned would work.

One possible selection of which mouse coordinates to use would be easy in my mind: It would be the coordinates where the mouse was located when the user right-clicked to get the menu that started the plug-in. If some other mechanism was used to start the plug-in that did not require a mouse click within the displayed image boundaries, then the mouse coordinates could be either undefined, or preferably a special value like maybe (-1,-1). However, if there were some way for the plug-in to communicate with the gimp to request that a selection/mouse click be made, that would probably be even better.

In any event, at least I know now that my emails are getting through to the list ok. Thanks again for your reply.

Regards, s/KAM

----- Original Message ----- From: "Michael J. Hammel"
To: "Kevin Myers"
Cc: "Gimp Developer List"
Sent: Tuesday, October 15, 2002 9:02 PM Subject: Re: [Gimp-developer] Mouse Coordinates for gimp Script or Plug-in

Thus spoke Kevin Myers

The other day I sent the following message to both the gimp users and

gimp

developers lists, hoping to determine whether there is any way to obtain image coordinates from a mouse click in a gimp plug-in. So far I

haven't

received a single reply. Are there really any of you out there??? :-)

Even

if you don't know or can't answer my question, it might be nice to

receive a

few replies anyway so I can at least confirm that my message actually

got

through ok.

The developers are here. Probably just busy. :-) I saw you're message the other day but didn't have time to look into it.

If there is presently no way for a gimp plug-in to obtain mouse click

image

coordinates (either at point of menu invocation or later), then I would

like

to submit this as a suggestion to be considered for a future release.

I'm not aware of a way to get the mouse coordinates from a mouse click in

a

canvas window over to the plug-in. Normally, plug-ins will copy the

drawable

(layer, selection, or whatever) into their own space to work on it, and translate their (possibly) scaled version's coordinates into those on the canvas. While not optimal, it should work for you.

The problem, as I see it, is that the communications channel between the

GIMP

and plug-ins is not event driven but rather function driven - you must

invoke

an API call to communicate with the GIMP. Actually, I don't think of that

as a

problem. It's just the way things work. At least from what I know.

One way around this - which would probably be an ugly hack - would be to

have

the GIMP save the click location for a canvas and let the plug-in query

for

that location. It might be similar to a one-pixel selection. Might be a problem in knowing when a click is supposed to set that location and when

it's

supposed to be applied to the currently active tool.

Anyway, it's just a thought. For now, you need to copy the drawable into

your

space to get coordinates via a preview window.

BTW, if anyone is interested, I've updated Shawn Amundson's preview widget

and

put it into a Glade-based template plug-in. That might be helpful as a

start

for you. Or maybe not. It's still a work in progress to make it a very

useful

template. Needs documentation, etc. But you can use Glade to edit the interface.

http://www.graphics-muse.org/source/gfxmuse.tar.gz

It's imake based 'cuz I know imake, not autoconf. --
Michael J. Hammel | Knowledge comes, The Graphics Muse | but wisdom lingers. mjhammel@graphics-muse.org | Tennyson, "Locksley Hall" http://www.graphics-muse.com