;; -*-scheme-*- ;; Alan Horkan 2004. No Copyright. Public Domain. ;; so long as remove this block of comments from your script ;; feel free to use it for whatever you like. ;; TODO give error messages or preferably status bar messages? ;; for back compatibility comment out the two lines marked gimp 2.0 specific (define (script-fu-guide-new-percent image drawable direction position) ;; (gimp-image-undo-group-start image) ; gimp 2.0 specific ;; (gimp-undo-push-group-start image) ; gimp 1.2 (let* ( (width (car (gimp-drawable-width drawable))) (height (car (gimp-drawable-height drawable))) ) (print position) (if (= direction 0) (set! position (/ (* height position) 100) ) (set! position (/ (* width position) 100) ) ) (print position) (if (= direction 0) ;; convert position to pixel (if (< position height) (gimp-image-add-hguide image position)) (if (< position width) (gimp-image-add-vguide image position)) ) (gimp-displays-flush) ) ;; (gimp-image-undo-group-end image) ; gimp 2.0 specific ;; (gimp-undo-push-group-end image) ; gimp 1.2 ) (script-fu-register "script-fu-guide-new-percent" _"/View/New Guide (by _Percent)..." _"Add a single Line Guide with the specified postion. Position specified as a percent of the image size. Written by request for Lincoln Lordello (Brazil). Donations welcome :)" "Alan Horkan. " ; author "Alan Horkan, 2004. Public Domain. " ; (no) copyright "2004 04 02. " ; date yyyy mm dd "*" ; works with all image types SF-IMAGE "Input Image" 0 SF-DRAWABLE "Input Drawable" 0 ; Direction/Orientation SF-OPTION _"Direction" '( _"Horizontal" _"Vertical" ) ;; TODO Postion units other than pixels such as centimetres (cm) SF-ADJUSTMENT "Position (in %)" '(50 0 100 1 10 0 1) )