; show-bounds.scm - Show the bounds of a selection. ; Version: 1.1. ; GIMP Script-Fu by Pedro Gimeno Fortea. ; Donated to the public domain. ; ; Revision history: ; 1.0 (2004-07-24): First version. ; 1.1 (2005-04-09): Notify when there's no selection active. Also give ; (x2,y2) as inclusive, not exclusive. ; (define (script-fu-selection-show-bounds img drawable) (let* ((bounds (gimp-selection-bounds img)) (sx1 (number->string (cadr bounds))) (sy1 (number->string (caddr bounds))) (sx2 (number->string (- (car (cdddr bounds)) 1))) (sy2 (number->string (- (cadr (cdddr bounds)) 1)))) (gimp-message (string-append (if (= (car bounds) 1) _"Selection extents:" _"No selection active. Image extents:") "\n x1=" sx1 "\n y1=" sy1 "\n x2=" sx2 "\n y2=" sy2)))) (script-fu-register "script-fu-selection-show-bounds" _"/Script-Fu/Selection/Show Selection B_ounds" _"Show all four coordinates of the selection bounds." "Pedro Gimeno Fortea" _"Public Domain" "2004-07-24" "RGB*, GRAY*, INDEXED*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0)