; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; Selection to Transparent Layer ; Copyright (c) 2000-2002 Matteo Nastasi aka MatOfPenguins aka mop ; nastasi@alternativeoutput.it ; matteo.nastasi@milug.org ; ; ; This program derive from: ; Selection to Image ; Copyright (c) 1997 Adrian Likins ; aklikins@eos.ncsu.edu ; ; Takes the Current rectangular selection and put it as a new layer of image. ; ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (define (script-fu-mop-im-select-to-trasplay image drawable name) (let* ((selection-bounds 0) (select-offset-x 0) (select-offset-y 0) (selection-width 0) (selection-height 0) (active-lay 0) (new-draw 0) (draw-type (car (gimp-drawable-type-with-alpha drawable))) (image-type (car (gimp-image-base-type image)))) (set! selection-bounds (gimp-selection-bounds image)) (set! select-offset-x (cadr selection-bounds)) (set! select-offset-y (caddr selection-bounds)) (set! selection-width (- (cadr (cddr selection-bounds)) select-offset-x)) (set! selection-height (- (caddr (cddr selection-bounds)) select-offset-y)) (set! active-lay (car (gimp-image-get-active-layer image))) (gimp-undo-push-group-start image) (if (= (car (gimp-selection-is-empty image)) TRUE) (gimp-message "Selection empty") (begin (set! new-draw (car (gimp-layer-new image selection-width selection-height 1 name 100 NORMAL))) (gimp-image-add-layer image new-draw 0) (gimp-layer-set-offsets new-draw select-offset-x select-offset-y) (gimp-edit-clear new-draw) (gimp-image-set-active-layer image active-lay) (gimp-displays-flush)) ) (gimp-undo-push-group-end image) )) (script-fu-register "script-fu-mop-im-select-to-trasplay" "/Script-Fu/MOP/Select To Trasp Lay" "Convert a selection to a new transparent layer" "Matteo Nastasi " "Matteo (Of Pinguins) Nastasi" "09/11/2000" "RGB RGBA GRAY GRAYA" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-STRING "Name of layer" "transp-sel")