;; -*-scheme-*- ;; Alan Horkan 2004. Public Domain. ;; so long as remove this block of comments from your script ;; feel free to use it for whatever you like. ;; TODO give feedback, 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 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))) ) (if (= direction 0) ;; check position is inside the image boundaries (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" _"/View/New Guide..." _"Add a single Line Guide with the specified postion and orientation. Postion is specified in Pixels (px). SEE ALSO 'New Guides' or 'Grid of Guides', for adding more than one Guide at a time. This script was designed to replicate the feature 'View, New Guide...' from Adobe Photoshop 7.0 as closely as possible to allow for objective comparision to the 'New Guides' script which was based on James Martins 'Grid of Guides' script. " "Alan Horkan. " ; author "Alan Horkan, 2004. Public Domain. " ; rights "2004 04 02 UTC" ; date, please use UTC format YYYY MM DD "" ; works with all image types SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 ; Direction/Orientation SF-OPTION _"Direction" '( _"Horizontal" _"Vertical" ) ;; TODO Postion units other than pixels such as centimetres (cm) SF-ADJUSTMENT "Position" '(0 0 1000 1 10 0 1) )