; Transparent-Object ; version 0.2 ; ; based on Ron Scott's technique at GUG ; http://gug.sunsite.dk/tutorials/ronq2/ ; ; (c) 2004 Fletcher T. Penney ; ; The GIMP -- an image manipulation program ; Copyright (C) 2004 Fletcher T. Penney ; ; 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. ; ; Version History ; ; 0.2 Used inverted colors for bump map, and then reinvert - I ; liked the effect better than my original approach, and it ; is the way Ron Scott originally had it. However, I invert ; the bump-map so that the highlights and the drop-shadow are ; more physically consistent ( for default settings anyway) ; ; 0.1 Original Version ; (define (script-fu-transparent-object-logo-alpha img logo-layer shadow-offset-x shadow-offset-y bump-depth blur-radius shrink-radius feather-radius final-color ) (begin (gimp-image-undo-group-start img) ; Create selection from logo-layer alpha (gimp-selection-layer-alpha logo-layer) (let* ((width (car (gimp-image-width img))) (height (car (gimp-image-height img))) (object-layer (car (gimp-layer-new img width height RGBA-IMAGE "Object" 100 NORMAL-MODE))) (color-object-layer (car (gimp-layer-new img width height RGBA-IMAGE "Colored-Object" 100 NORMAL-MODE))) ) ; Create a new layer with object mask (gimp-image-add-layer img object-layer -1) (gimp-palette-set-foreground '(255 255 255)) (gimp-edit-fill object-layer FOREGROUND-FILL) (gimp-selection-none img) ; Blur it (plug-in-gauss-rle 1 img object-layer blur-radius TRUE TRUE) (gimp-drawable-set-visible object-layer 0) (gimp-drawable-set-visible logo-layer 0) ; Create a new layer with colored object (gimp-image-add-layer img color-object-layer -1) ; (gimp-palette-set-foreground '(130 105 78)) (gimp-palette-set-foreground final-color) (gimp-selection-layer-alpha logo-layer) (gimp-edit-fill color-object-layer FOREGROUND-FILL) ; invert the color (gimp-invert color-object-layer) (gimp-selection-none img) ; Bump map using the blurred object-layer (plug-in-bump-map 1 img color-object-layer object-layer 135 45 bump-depth 0 0 0 0 0 1 0) ; Reinvert the color (gimp-invert color-object-layer) ; Shrink selection (gimp-selection-layer-alpha logo-layer) (gimp-selection-shrink img shrink-radius) (gimp-selection-feather img feather-radius) ; Duplicate the layer to create drop-shadow (set! shadow-layer (car (gimp-layer-copy color-object-layer 1))) (gimp-image-add-layer img shadow-layer 1) (gimp-drawable-set-name shadow-layer "Drop-Shadow") ; Create drop-shadow ( but use alpha - this is an improvement over Ron's ; technique - IMHO) ; First, delete the middle so the shadow only shows the edges (gimp-edit-clear shadow-layer) (gimp-selection-none img) (plug-in-gauss-rle 1 img shadow-layer 10.0 TRUE TRUE) (gimp-layer-set-preserve-trans shadow-layer TRUE) (gimp-palette-set-background '(0 0 0)) (gimp-edit-fill shadow-layer BACKGROUND-FILL) (gimp-layer-set-preserve-trans shadow-layer FALSE) (gimp-drawable-offset shadow-layer 0 1 shadow-offset-x shadow-offset-y) ; reset selection for manual alpha curve change (gimp-image-set-active-layer img color-object-layer) (gimp-selection-layer-alpha logo-layer) (gimp-selection-shrink img shrink-radius) (gimp-selection-feather img feather-radius) ) (gimp-message "Now you can alter the translucency of the object by adjusting the Alpha channel curve. The interior of the object has been pre-selected for you.") (gimp-image-undo-group-end img) (gimp-displays-flush) ) ) (script-fu-register "script-fu-transparent-object-logo-alpha" _"/Script-Fu/Alpha to Logo/_Transparent Object..." "Create a transparent object based on the alpha channel of the selected layer. You can then edit the curve for the alpha channel to change the opacity of the object. Based on Ron Scott's Transparent Objects tutorial.\012\012" "Fletcher T. Penney" "Fletcher T. Penney" "2004" "RGBA" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-ADJUSTMENT _"Shadow Offset X" '(12 -100 100 1 10 0 0) SF-ADJUSTMENT _"Shadow Offset Y" '(12 -100 100 1 10 0 0) SF-ADJUSTMENT _"Bump-Map Depth" '(4 0 20 1 1 1 0) SF-ADJUSTMENT _"Blur Radius" '(5 0 20 .1 1 1 0) SF-ADJUSTMENT _"Edge Thickness" '(3 0 20 1 10 0 0) SF-ADJUSTMENT _"Edge Feathering" '(2 0 20 1 10 0 0) SF-COLOR _"Object Color" '(255 255 255) )