Re: [Gimp-developer] Pixel coordinates input type for script-fu?

2007-05-02 Thread Sven Neumann
Hi,

On Tue, 2007-05-01 at 13:35 -0500, Kevin Myers wrote:
 I really need to get the coordinates directly and on the fly from the
 plug-in, as in click on button on plug-in's user interface to initiate
 pixel selection, then click in image (or preview?) to return coordinates
 to plug-in.

You can do that in the plug-in's preview window.


Sven


___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Pixel coordinates input type for script-fu?

2007-05-02 Thread coolhand

You cou use the selection tool and get the selection or use the path tool's
initial point, or create a preview window, where you can get events more
directly. Other way is to associate a key binding at your plugin that
catches the position of your mouse in that moment and then get the pixel
value...
-- 
View this message in context: 
http://www.nabble.com/Pixel-coordinates-input-type-for-script-fu--tf3673229.html#a10283802
Sent from the Gimp Developer mailing list archive at Nabble.com.

___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Pixel coordinates input type for script-fu?

2007-05-02 Thread Mark Lowry

Joao,

Thanks for the help.  I figured out that aref works
to extract a vector element, while vector-ref does
not appear to be supported in GIMP.  I ended up using
a path consisting of 4 points created before running
the script to get my input points and things are
working nicely now.  It's not the cleanest way, but it
seems to be the best I can do with the tools at hand
right now.

I'll have to take a look at Python ...

Thanks again . Mark

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Pixel coordinates input type for script-fu?

2007-05-01 Thread Joao S. O. Bueno Calligaris
On Tuesday 01 May 2007 00:15, Mark Lowry wrote:
 I'm working on a script in which it would be
 advantageous to use the mouse to click on an image and
 have the pixel coordinates captured as an input.
 Right now I have to manually enter the coordinates for
 four points, which is a tedious process.

 Is there a way to capture these coordinates as inputs
 to a script?  If not, where is the appropriate place
 to suggest a feature request for this?


Hi - no, there is no official way to do that.

What I do in my scripts is require the user to start a Path with the 
bezier tool before calling the script - The script then use the 
coordiantes of the first (or how many I want) points of this path as 
input coordinates. These can e read through the PDB.

js
--
 Thanks . Mark

 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
 ___
 Gimp-developer mailing list
 Gimp-developer@lists.XCF.Berkeley.EDU
 https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Pixel coordinates input type for script-fu?

2007-05-01 Thread William Skaggs


From: Mark Lowry [EMAIL PROTECTED]

I'm working on a script in which it would be
advantageous to use the mouse to click on an image and
have the pixel coordinates captured as an input. 
Right now I have to manually enter the coordinates for
four points, which is a tedious process.

Is there a way to capture these coordinates as inputs
to a script?  If not, where is the appropriate place
to suggest a feature request for this?


GIMP Bugzilla is the place to request features, but it is
often helpful to discuss them on this list first, as you
are doing.

As Joao said, the functionality doesn't exist right now.  I
wonder if the best way to get it would be to use sample points,
which you can create by Ctrl-clicking on a ruler and dragging
into the image, and can even move around after they have been
created, by activating the Color Picker tool and click-dragging
a sample point.  Sample points are a new feature, and code hasn't
yet been written to allow a plug-in to request the list of sample
points belonging to an image, but it would be pretty straightforward
to do so.

  -- Bill
 

 
__ __ __ __
Sent via the CNPRC Email system at primate.ucdavis.edu


 
   
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Pixel coordinates input type for script-fu?

2007-05-01 Thread Kevin Myers
As mentioned previously on this list, I would also like to develop a plug-in 
with similar pixel coordinate requirements.  For my purposes, using the 
color picker would be an extremely ugly and practically unusable hack.  I 
really need to get the coordinates directly and on the fly from the plug-in, 
as in click on button on plug-in's user interface to initiate pixel 
selection, then click in image (or preview?) to return coordinates to 
plug-in.

Kevin M.


- Original Message - 
From: William Skaggs [EMAIL PROTECTED]
To: gimp-developer gimp-developer@lists.XCF.Berkeley.EDU
Sent: Tuesday, May 01, 2007 11:52
Subject: Re: [Gimp-developer] Pixel coordinates input type for script-fu?




 From: Mark Lowry [EMAIL PROTECTED]

I'm working on a script in which it would be
advantageous to use the mouse to click on an image and
have the pixel coordinates captured as an input.
Right now I have to manually enter the coordinates for
four points, which is a tedious process.

Is there a way to capture these coordinates as inputs
to a script?  If not, where is the appropriate place
to suggest a feature request for this?


 GIMP Bugzilla is the place to request features, but it is
 often helpful to discuss them on this list first, as you
 are doing.

 As Joao said, the functionality doesn't exist right now.  I
 wonder if the best way to get it would be to use sample points,
 which you can create by Ctrl-clicking on a ruler and dragging
 into the image, and can even move around after they have been
 created, by activating the Color Picker tool and click-dragging
 a sample point.  Sample points are a new feature, and code hasn't
 yet been written to allow a plug-in to request the list of sample
 points belonging to an image, but it would be pretty straightforward
 to do so.

  -- Bill



 __ __ __ __
 Sent via the CNPRC Email system at primate.ucdavis.edu




 ___
 Gimp-developer mailing list
 Gimp-developer@lists.XCF.Berkeley.EDU
 https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
 


___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Pixel coordinates input type for script-fu?

2007-05-01 Thread Mark Lowry

--- Joao S. O. Bueno Calligaris [EMAIL PROTECTED]
wrote:
 
 Hi - no, there is no official way to do that.
 
 What I do in my scripts is require the user to start
 a Path with the 
 bezier tool before calling the script - The script
 then use the 
 coordiantes of the first (or how many I want) points
 of this path as 
 input coordinates. These can e read through the PDB.
 
   js
   --


I have thought about doing that and I think that is
the way I will have to go.  I'm confused with how to
extract elements from the vector returned by
gimp-path-get-points.  I thought I understood that
(vector-ref vector k) was the way to pull the k-1
element from the vector, but when I input (vector-ref
'#(1 1 2 3 5 8 13 21) 5) I just get an errobj on
vector-ref.  What do I need to do to be able to
extract a value from the result of
(gimp-path-get-points image path)?


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Pixel coordinates input type for script-fu?

2007-05-01 Thread Joao S. O. Bueno Calligaris
On Tuesday 01 May 2007 17:05, Mark Lowry wrote:
 --- Joao S. O. Bueno Calligaris [EMAIL PROTECTED]

 wrote:
  Hi - no, there is no official way to do that.
 
  What I do in my scripts is require the user to start
  a Path with the
  bezier tool before calling the script - The script
  then use the
  coordiantes of the first (or how many I want) points
  of this path as
  input coordinates. These can e read through the PDB.
 
  js
  --

 I have thought about doing that and I think that is
 the way I will have to go.  I'm confused with how to
 extract elements from the vector returned by
 gimp-path-get-points.  I thought I understood that
 (vector-ref vector k) was the way to pull the k-1
 element from the vector, but when I input (vector-ref
 '#(1 1 2 3 5 8 13 21) 5) I just get an errobj on
 vector-ref.  What do I need to do to be able to
 extract a value from the result of
 (gimp-path-get-points image path)?

oh man.,..
2 things:
1) I do python-fu, not Scheme (script-fu) - so I have erased from my 
mind the esoteric ways of getting elements out of a vector or array 
in Scheme. btw, if your plug-in is of any complexity, unless you 
think your time is being well spent as you exercise your mind around 
how to get and use data with scheme expressions as an extra exercise, 
I'd  suggest writting it in python. If you are on windows, that will 
only work witht he developemtn version of GIJMP, though. But it has 
the advantadge of letting you worry with your problem instead of the 
language _and_ your problem.


2) this very API is being obsoleted in GIMP 2.3.x - there are all new 
vector manipulation calls in place, that can finally deal correctly 
with multiple stroke vectors (not needed to fecth just one or two 
coordinates anyway)

In python, an interactiuve session exploring the return values might 
just display:
 img = gimp.image_list()[0]
 pdb.gimp_path_get_points (img, a)
(1, 0, 15, (103.03428571428572, 101.01142857142861, 1.0, 
104.74857142857149, 98.902857142857101, 2.0, 529.68571428571431, 
102.38, 2.0, 529.480002, 102.039996, 1.0, 
529.27428571428572, 101.679995, 2.0))
 v = pdb.gimp_path_get_points (img, a)
 points  = v[3]
 points
(103.03428571428572, 101.01142857142861, 1.0, 104.74857142857149, 
98.902857142857101, 2.0, 529.68571428571431, 102.38, 2.0, 
529.480002, 102.039996, 1.0, 529.27428571428572, 
101.679995, 2.0)
 points[0], points[1]
(103.03428571428572, 101.01142857142861)

(the   are the prompt, not part of the language)


--
Bill...could you see if it iyou can add a simple api for retrieving 
the sample points? I think this will bother no one at this point, it 
is starightforward as you said, and...we want to get 2.4 out, so it 
has to be done real soon.

js
--


 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer