Barton ([EMAIL PROTECTED]) wrote:
> I've been doing a little python-fu lately and find that in 2.3.18 
> stroking paths uses vector objects.  So far I haven't turned up any 
> practical examples of the use of the various pdb vectors functions in 
> the source or on the Web, nor had any success through trial and error.
> Could someone point me to documentation for the pdb vectors procedures 
> and/or post a brief sample python-fu snippet that creates a circular 
> path and then draws a circle by stroking the path/vector?

Here is a simple script-fu script to construct an circle and stroke it,
It should be possible to convert it to python easily.

Note that you right now cannot control every aspect of stroking, since
the gimp context does not yet store stuff like e.g. a dash pattern.

I hope this helps.
              [EMAIL PROTECTED]    
(define (script-fu-draw-circle image layer)
        (let* (
               (w (car (gimp-image-width image)))
               (vectors 0)
          (set! vectors (car (gimp-vectors-new image "circle")))
          (gimp-image-add-vectors image vectors -1)
          (gimp-vectors-bezier-stroke-new-ellipse vectors (/ w 2) (/ w 2) (/ w 
3) (/ w 3) 0)
          (gimp-edit-stroke-vectors layer vectors)

(script-fu-register "script-fu-draw-circle"
                    "Draw Circle"
                    "Sample script to draw a circle"
                    "Simon Budig"
                    "(c) 2007 Simon Budig"
                    "4. 09. 2007"
                    SF-IMAGE      "input image" -1
                    SF-DRAWABLE   "active drawable" -1

(script-fu-menu-register "script-fu-draw-circle"
Gimp-developer mailing list

Reply via email to