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.39999999999998, 2.0, 529.48000000000002, 102.03999999999996, 1.0, 
529.27428571428572, 101.67999999999995, 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.39999999999998, 2.0, 
529.48000000000002, 102.03999999999996, 1.0, 529.27428571428572, 
101.67999999999995, 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

Reply via email to