GIMP Chat
http://gimpchat.com/

Help I am stuck with this script (SOLVED)
http://gimpchat.com/viewtopic.php?f=9&t=13612
Page 1 of 1

Author:  trandoductin [ Sat Jan 30, 2016 2:47 pm ]
Post subject:  Help I am stuck with this script (SOLVED)

Just trying to create a script that's drawing a path that represents the Golden Ratio/Phi grid.
with 3 rectangles.

It's giving me this error and I have no idea why.

Execution error for 'New Golden Ratio/Phi Path':
Error: ( : 1) Procedure execution of gimp-vectors-stroke-new-from-points failed

; -*-scheme-*-
; Tin Tran 2016.  No copyright.  Public Domain.
; Based on Guillermo Maldonado Rule of Thirds
(define (script-fu-path-gr image drawable)
    (let* (
        (width (car (gimp-image-width image)))
        (height (car (gimp-image-height image)))
      (new-vector (car (gimp-vectors-new image "Phi Grid")))
      (new-stroke 0)
      
        )
   (gimp-image-insert-vectors image new-vector 0 0)
   ;border path
   (gimp-vectors-stroke-new-from-points new-vector 0 8
                           (list->vector (list
                           0 0
                           width 0
                           width height
                           0 height
                           ))
                           TRUE)
                           
   ;vertical Phi rectangle
   (gimp-vectors-stroke-new-from-points new-vector 0 8
                           (list->vector (list
                           (/ (* width 382) 1000) 0
                           (/ (* width 1000) 1618) 0
                           (/ (* width 1000) 1618) height
                           (/ (* width 382) 1000) height
                           ))
                           TRUE)
                           
   ;horizontal Phi rectangle
   (gimp-vectors-stroke-new-from-points new-vector 0 8
                           (list->vector (list
                           0     (/ (* height 382) 1000)   
                           width (/ (* height 382) 1000)
                           width (/ (* height 1000) 1618)
                           0     (/ (* height 1000) 1618)
                           ))
                           TRUE)
                           
    (gimp-displays-flush)
  )
)

(script-fu-register "script-fu-path-gr"
  "New Golden Ratio/Phi Path"
  "Adds Golden Ratio/Phi Path"
  "Tin Tran"
  "Tin Tran, 2016"
  "Jan 2016"
  ""
  SF-IMAGE      "Input Image"      0
  SF-DRAWABLE   "Input Drawable"   0
)

(script-fu-menu-register "script-fu-path-gr"
                         "<Image>/Script-Fu/Create New/")


Attachments:
golden-rule-path.scm [1.53 KiB]
Downloaded 94 times

Author:  saulgoode [ Sat Jan 30, 2016 3:49 pm ]
Post subject:  Re: Help I am stuck with this script

You need to supply 'gimp-vectors-stroke-new-from-points' with the control handle coordinates as well as the anchor coordinates. For a polygonal path, the control handle coordinates are the same as the anchor coordinates.

(gimp-vectors-stroke-new-from-points new-vector 0 24
                           (vector
                             0 0 0 0 0 0
                             width 0 width 0 width 0
                             width height width height width height
                             0 height 0 height 0 height
                             )
                           TRUE)

Author:  trandoductin [ Sat Jan 30, 2016 4:28 pm ]
Post subject:  Re: Help I am stuck with this script (SOLVED)

thank you.
This is good to know for future references.
I found a Golden sections guide in gimp too so i don't have to build a script that does it :hehe

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/