; select-layer.scm - By default, Select All creates a selection whose extent ; is the size of the image. This script creates a selection with a size ; equal to the currently selected layer's size. This allows some operations ; like e.g. Round Selection to work correctly on the layer's extents. ; ; The script is registered into the image's Select menu. ; ; NOTE: Due to a limitation of The GIMP, if part of the layer lies outside ; the image, only the part which lies within the image bounds will be ; selected. ; ; Version: 1.0. ; GIMP Script-Fu by Pedro Gimeno Fortea. ; Donated to the public domain. ; ; Changes: ; 1.0 (2005-04-08): First revision. ; ; Select the current layer. ; (define (script-fu-select-layer image drawable) (let* ((offsets (gimp-drawable-offsets drawable)) (x (car offsets)) (y (cadr offsets)) (w (car (gimp-drawable-width drawable))) (h (car (gimp-drawable-height drawable)))) (gimp-rect-select image x y w h CHANNEL-OP-REPLACE 0 0))) ; Register the function. ; (script-fu-register "script-fu-select-layer" _"/Select/Current La_yer" _"Create a selection with the size of the currently active layer." "Pedro Gimeno Fortea" _"Public Domain" "2005-04-08" "RGB*, GRAY*, INDEXED*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0)