; GIMP - The GNU Image Manipulation Program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; 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. ; ; ; Creates a chrome-looking text, similar to the steps described in this ; tutorial by needcoffee: http://needcoffee.deviantart.com/art/short-chrome-tutorial-35851757 ; The curves were adjusted a bit from those set in the tutorial to ; ; Just highlight the text layer and run the script, which is found on the ; Filters Menu > Alpha to Logo > Fencepost Chrome.... ; Update February 19, 2008: Modified the way the script works with adding color to the chrome. ; Define the Function (define (script-fu-chrome-text-fp image drawable useColor desiredColor addShadow offsetX offsetY blurRadius shadowColor opacity keepBumpMap ) ;Declare the Variables (let* ( (theHeight (car (gimp-image-height image))) (theWidth (car (gimp-image-height image))) (theType (car (gimp-drawable-type-with-alpha drawable))) (theSelection) (bumpMapBase) (bumpMapLayer) (originalLayer) (gradientType) (shadowLayer) (position) (colorLayer) ) ; Set up the script so that user settings can be reset after the script is run (gimp-context-push) ; Start an Undo Group so script can be undone in one step (gimp-image-undo-group-start image) ; Save any active selections to a channel so script can be run on whole layers and then turn off selection (set! theSelection (car (gimp-selection-save image))) (gimp-selection-none image) ; Set the active layer (gimp-image-set-active-layer image drawable) ; Set the foreground/background colors (gimp-context-set-foreground '(255 255 255)) (gimp-context-set-background '(0 0 0)) ; Assign the bumpMapLayer and originalLayer, add the originalLayer above the bumpMapLayer ; & add the layer name to bumpMapLayer. Lock the transparency for both layers so that ; fills will be added only to non-transparent areas. Alpha to selection was tried for this ; script, but results weren't as good. The bumpMapLayer and OriginalLayer are linked for ; later movement around the canvas if so desired. (set! bumpMapBase (car (gimp-image-get-active-layer image))) (set! bumpMapLayer (car (gimp-layer-copy bumpMapBase TRUE))) (set! originalLayer (car (gimp-layer-copy bumpMapLayer TRUE))) (gimp-layer-resize-to-image-size bumpMapBase) (gimp-edit-fill bumpMapBase BACKGROUND-FILL) (gimp-drawable-set-name bumpMapBase "Bump Map Layer") (gimp-image-add-layer image bumpMapLayer -1) (gimp-layer-set-preserve-trans bumpMapLayer TRUE) (gimp-edit-fill bumpMapLayer FOREGROUND-FILL) (set! bumpMapLayer (car (gimp-image-merge-down image bumpMapLayer CLIP-TO-IMAGE))) (plug-in-gauss-iir2 1 image bumpMapLayer 10 10) ; Set bumpMapLayer invisible (gimp-drawable-set-visible bumpMapLayer FALSE) ; Add the originalLayer to the image above the bumpMapLayer, resize it to be the same ; size as the whole image and set 'preserve transparency' on. (gimp-image-add-layer image originalLayer -1) (gimp-layer-resize-to-image-size originalLayer) (gimp-layer-set-preserve-trans originalLayer TRUE) ; Fill the originalLayer with gray before running the Curves Tool. If no other color is used, ; this will give the text a shiny silver color. (gimp-context-set-foreground '(221 221 221)) (gimp-edit-fill originalLayer FOREGROUND-FILL) ; The bump map plugin is run using the bumpMapLayer to give the originalLayer its rounded look (plug-in-bump-map 1 image originalLayer bumpMapLayer 127 35 5 0 0 0 0 TRUE FALSE 2) ; Define the curve-spline function to be set the Curves Tool Values and then run the Curves Tool ; on the originalLayer (let* ((curve-spline (cons-array 10 'byte))) (aset curve-spline 0 0) (aset curve-spline 1 0) (aset curve-spline 2 64) (aset curve-spline 3 200) (aset curve-spline 4 128) (aset curve-spline 5 46) (aset curve-spline 6 210) (aset curve-spline 7 137) (aset curve-spline 8 255) (aset curve-spline 9 255) (gimp-curves-spline originalLayer HISTOGRAM-VALUE 10 curve-spline) ) ; If user decides the chrome to be a specific color, a new layer (colorLayer) is created and added ; above the originalLayer. The colorLayer is filled with the desired color and its mode is set to ; 'Color' mode and then merged with the originalLayer. Otherwise, the color of the chrome is left ; at the default 'silver'. (if (= useColor TRUE) (begin (gimp-context-set-foreground desiredColor) (set! colorLayer (car (gimp-layer-copy originalLayer TRUE))) (gimp-image-add-layer image colorLayer -1) (gimp-edit-fill colorLayer FOREGROUND-FILL) (gimp-layer-set-mode colorLayer COLOR-MODE) (gimp-image-merge-down image colorLayer CLIP-TO-IMAGE) (set! originalLayer (car (gimp-image-get-active-layer image))) ) ) ; If the user wants to keep the bumpMapLayer for later use, it will be kept in this step. ; Otherwise, the layer is deleted. (if (= keepBumpMap FALSE) (gimp-image-remove-layer image bumpMapLayer) ) ; If the user wants to add a drop shadow, the parameters entered in when the script was first ; run are put into the existing GIMP drop shadow script. (if (= addShadow TRUE) (script-fu-drop-shadow image originalLayer offsetX offsetY blurRadius shadowColor opacity FALSE) ) ; The original selection is reloaded and its channel is deleted (gimp-selection-load theSelection) (gimp-image-remove-channel image theSelection) ; The originalLayer is made active (gimp-image-set-active-layer image originalLayer) ; Closes the undo group (gimp-image-undo-group-end image) ; Tells GIMP that a change has been made (gimp-displays-flush) ; Resets previous user settings (gimp-context-pop) ) ) ; Registers the Script with the PB (script-fu-register "script-fu-chrome-text-fp" "/Filters/Alpha to Logo/Fencepost Chrome..." "Make a chrome-looking text" "Art Wade" "Art Wade" "1/18/2008" "RGB*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-TOGGLE "Colorize the Chrome?" FALSE SF-COLOR "Desired Chrome Color" '(221 221 221) SF-TOGGLE "Add Drop Shadow?" TRUE SF-ADJUSTMENT "Offset X" '(3 -4096 4096 1 10 0 1) SF-ADJUSTMENT "Offset Y" '(3 -4096 4096 1 10 0 1) SF-ADJUSTMENT "Blur radius" '(5 0 1024 1 10 0 1) SF-COLOR "Color" '(0 0 0) SF-ADJUSTMENT "Opacity" '(80 0 100 1 10 0 0) SF-TOGGLE "Keep Bump Map Layer?" FALSE )