; -*-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/")
