Re: [Gimp-user] A better way to close a path where an end node is on top of a start node



ugajin talktalk net (ugajin talktalk net) wrote:
Simon - I don't see how this will work in the scenario described.

We're talking about programmatically constructing a stroke within a
vectors object, that has its end node placed on the start node and then
is supposed to be closed. right?

I started a new gimp instance and issued the following commands in the
script fu console:

(gimp-image-list)
(1 #(1))

(gimp-vectors-new 1 "testpath")
(3)

(gimp-image-insert-vectors 1 3 0 0)
(#t)

(gimp-vectors-bezier-stroke-new-moveto 3 100 100)
(1)

(gimp-vectors-bezier-stroke-cubicto 3 1 150 100 200 150 200 200)
(#t)

(gimp-vectors-bezier-stroke-cubicto 3 1 150 200 100 150 100 100)
(#t)

(gimp-vectors-stroke-get-points 3 1)
(0 18 #(100.0 100.0 100.0 100.0 150.0 100.0 200.0 150.0 200.0 200.0
150.0 200.0 100.0 150.0 100.0 100.0 100.0 100.0) 0)

(gimp-vectors-stroke-close 3 1)
(#t)

(gimp-vectors-stroke-get-points 3 1)
(0 12 #(100.0 150.0 100.0 100.0 150.0 100.0 200.0 150.0 200.0 200.0
150.0 200.0) 1)

This is constructing a path with two bezier segments, where the end of
the last segment coincides with the start of the first segment.

As you can see gimp-vectors-stroke-close reduced the number of points:
Gimp has determined, that the first and the last control point are on
top each other and that their respective control handles do not hold
relevant information (since their coordinates are identical with the
anchor handle).

So the final result after the stroke-close contains exactly six handles
(i.e. the coordinate array contains 12 elements). Which IMHO is the
desired result.

I hope this helps,
        Simon

-- 
              simon budig de              http://simon.budig.de/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]