It is currently Sat Sep 19, 2026 9:01 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Question for Path editor experts
PostPosted: Thu May 05, 2011 2:30 pm  (#1) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
GIMP Version: 2.6.8
Operating System: Linux
OS Version: Kubuntu 10.04
GIMP Experience: Advanced Level



1) When you drag the "handles" on a control points, you can force them to be aligned and symmetrical by depressing Shift when you drag. But is there a key combo to have them aligned but not symmetrical?

2) If you mark create a path with straight lines with a few plain clicks, you can later obtain Bezier curve handles on them by Ctrl-click. But is there a way to predict which handle you will get (ie, if you need to drag to the right or the left...)

3) I sometimes end up with two points that are linked (they move together if I drag one of them). How do I get there (in case it's useful someday)?

_________________
Image


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Question for Path editor experts
PostPosted: Thu May 05, 2011 2:45 pm  (#2) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6946
Location: Somewhere in GIMP
When clicking an anchor point with the Ctrl key down, my experience is that the first handle goes which ever way you move it (while still holding down the Ctrl key). The other handle (while still holding down the Ctrl key) you can move in another direction.

Of course, if you want them straightened, you use the Shift key, which you already know.

I hope I understood your question correctly.

Image

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Thu May 05, 2011 3:16 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
1) Not to my knowledge.

2) It always seems to be the "from" (or "into") control point which is accessed first. That is, given a polygonal path from A to B to C, clicking on B while holding the CTRL key will select B's handle which directs "from A" towards B.

3) You can select multiple anchors by holding down SHIFT while clicking on an anchor. All anchors in such a selected group move in concert (along with their associated control handles).

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Thu May 05, 2011 3:22 pm  (#4) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
Hmm. This is not what I get... if I click three points form left to right, and then Control-drag the middle point, I seem to always get the "back" handle:

Dragging right:
Attachment:
DragRight.png
DragRight.png [ 1.16 KiB | Viewed 4242 times ]


Dragging left:
Attachment:
DragLeft.png
DragLeft.png [ 1.13 KiB | Viewed 4242 times ]


And if I click the points right to left, I of course get the opposite behavior.

Strange.

_________________
Image


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Thu May 05, 2011 3:27 pm  (#5) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
saulgoode wrote:
1) Not to my knowledge.
Too bad. But at least it's not my oversight

saulgoode wrote:
2) It always seems to be the "from" (or "into") control point which is accessed first. That is, given a polygonal path from A to B to C, clicking on B while holding the CTRL key will select B's handle which directs "from A" towards B.
This seems coherent with what I get in well controlled conditions. Unfortunately Gimp path directionality isn't always preserved during path processing...

saulgoode wrote:
3) You can select multiple anchors by holding down SHIFT while clicking on an anchor. All anchors in such a selected group move in concert (along with their associated control handles).
That explains it, thanks.

_________________
Image


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Thu May 05, 2011 3:35 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
ofnuts wrote:
Unfortunately Gimp path directionality isn't always preserved during path processing...

I am certainly not disputing this claim; but if you are aware of a specific scenario which may corrupt the directionality of paths, I would appreciate if you let me know.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Fri May 06, 2011 1:26 pm  (#7) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
saulgoode wrote:
ofnuts wrote:
Unfortunately Gimp path directionality isn't always preserved during path processing...

I am certainly not disputing this claim; but if you are aware of a specific scenario which may corrupt the directionality of paths, I would appreciate if you let me know.


Speaking of - anyone know of a script to reverse path direction? I could have used one the other day and couldn't locate one in a quick search.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Fri May 06, 2011 2:32 pm  (#8) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
Reverse path or reverse only some stroke?

_________________
Image


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Fri May 06, 2011 3:22 pm  (#9) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
I believe the following code works (though I have not performed extensive testing).

; Reverse the strokes in a path.
; If the 'stroke' is not specified then all strokes will be reversed.
; Else 'stroke' can be either a single stroke or a list of strokes.
;
; Note: the original strokes are deleted and replaced by new strokes.
;
(define (fu-reverse-path image path . stroke)
  (let loop ((strokes (if (pair? stroke)
                        (if (pair? (car stroke))
                          (car stroke)
                          stroke )
                        (vector->list (cadr (gimp-vectors-get-strokes path))) )))
    (unless (null? strokes)
      (let* ((stroke-info (gimp-vectors-stroke-get-points path (car strokes)))
             (type (car stroke-info))
             (num-coords (cadr stroke-info))
             (coords (vector->list (caddr stroke-info)))
             (closed (cadddr stroke-info))
             (points
               (let loop ((coords coords)
                          (points nil) )
                 (if (null? coords)
                   (if (null? points)
                     points
                     (reverse points) )
                   (loop (cddr coords)
                         (cons (cons (car coords) (cadr coords)) points) )))))
        (set! coords
          (let loop ((points points)
                     (coords '()) )
            (if (null? points)
              (begin
                (gimp-vectors-stroke-new-from-points path
                                                     type
                                                     num-coords
                                                     (list->vector coords)
                                                     closed )
                (gimp-vectors-remove-stroke path (car strokes)) )
              (loop (cdr points)
                    (cons (caar points) (cons (cdar points) coords)) ))))
        (loop (cdr strokes)) ))))

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Fri May 06, 2011 3:41 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Oct 06, 2010
Posts: 4050
Hey Saulgoode, are you planning to add this to your scripts site?

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Fri May 06, 2011 4:23 pm  (#11) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
saulgoode wrote:
I believe the following code works (though I have not performed extensive testing).

; Reverse the strokes in a path.
; If the 'stroke' is not specified then all strokes will be reversed.
; Else 'stroke' can be either a single stroke or a list of strokes.
;
; Note: the original strokes are deleted and replaced by new strokes.
;
(define (fu-reverse-path image path . stroke)
  (let loop ((strokes (if (pair? stroke)
                        (if (pair? (car stroke))
                          (car stroke)
                          stroke )
                        (vector->list (cadr (gimp-vectors-get-strokes path))) )))
    (unless (null? strokes)
      (let* ((stroke-info (gimp-vectors-stroke-get-points path (car strokes)))
             (type (car stroke-info))
             (num-coords (cadr stroke-info))
             (coords (vector->list (caddr stroke-info)))
             (closed (cadddr stroke-info))
             (points
               (let loop ((coords coords)
                          (points nil) )
                 (if (null? coords)
                   (if (null? points)
                     points
                     (reverse points) )
                   (loop (cddr coords)
                         (cons (cons (car coords) (cadr coords)) points) )))))
        (set! coords
          (let loop ((points points)
                     (coords '()) )
            (if (null? points)
              (begin
                (gimp-vectors-stroke-new-from-points path
                                                     type
                                                     num-coords
                                                     (list->vector coords)
                                                     closed )
                (gimp-vectors-remove-stroke path (car strokes)) )
              (loop (cdr points)
                    (cons (caar points) (cons (cdar points) coords)) ))))
        (loop (cdr strokes)) ))))


Just done something equivalent (in Python of course, and without the stroke selection). A catch is that this doesn't preserve the order of the strokes, and this may be important (stroking the path with a gradient, for instance). The code would have to copy all strokes, reversing some in the process (and even then I have the hazy memory that you get them in the reverse order, at least with the python API...)

_________________
Image


Top
 Post subject: Re: Question for Path editor experts
PostPosted: Fri May 06, 2011 5:37 pm  (#12) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
reverse-strokes.py added to my SourceForge collection. You can select which strokes to reverse by surrounding them in a selection (actually the script only tests that at least one end point is in the selection).

_________________
Image


Top
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group