; 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 "tech-style" background with a "raised" 3D box overlay effect ; based on the tutorial here: ; http://www.gimpdome.com/forum/index.php?topic=6482 ; Script can be found under Filters > Render > Tech Background... ; The user sets the Color of the background and the box size. ; The default settings are those used in the tutorial, which gives the background ; a blue color and box size of 10. (define (script-fu-tech-background image drawable color blockSize) (let* ( (width (car (gimp-image-width image))) (height (car (gimp-image-height image))) (type RGBA-IMAGE) (backgroundLayer) (gridLayer) ) ; Set up the script so that user settings in place priot to the script can be reset after the script is run (gimp-context-push) ; Begin Undo Group (gimp-undo-push-group-start image) ; Create the backgroundLayer based on the current image dimensions and add it to the image (set! backgroundLayer (car (gimp-layer-new image width height type "Tech Background Layer" 100 NORMAL-MODE))) (gimp-image-add-layer image backgroundLayer -1) ; Set the foreground color and fill the backgroundLayer with it (gimp-context-set-foreground color) (gimp-drawable-fill backgroundLayer FOREGROUND-FILL) ; Add some noise to the backgroundLayer and run the pixelize filter setting ; the pixel size using the value set by the user (blockSize) (plug-in-scatter-rgb RUN-NONINTERACTIVE image backgroundLayer 0 0 0.3 0.3 0.3 0) (plug-in-pixelize RUN-NONINTERACTIVE image backgroundLayer blockSize) ; Create a copy of the backgroundLayer to be used for the Grid (gridLayer) ; add gridLayer to the image and fill it with Transparent Fill ; run the grid filter twice (once with white/once with black) using blockSize ; to set the width/height of the grids ; set the opacity and blend mode and merge the gridLayer with the backgroundLayer (set! gridLayer (car (gimp-layer-copy backgroundLayer TRUE))) (gimp-image-add-layer image gridLayer -1) (gimp-drawable-fill gridLayer TRANSPARENT-FILL) (plug-in-grid RUN-NONINTERACTIVE image gridLayer 1 blockSize 1 '(255 255 255) 255 1 blockSize 1 '(255 255 255) 255 0 0 0 '(0 0 0) 255) (plug-in-grid RUN-NONINTERACTIVE image gridLayer 1 blockSize 0 '(0 0 0) 255 1 blockSize 0 '(0 0 0) 255 0 0 0 '(0 0 0) 255) (gimp-layer-set-mode gridLayer GRAIN-EXTRACT-MODE) (gimp-layer-set-opacity gridLayer 15) (gimp-image-merge-down image gridLayer CLIP-TO-IMAGE) ; End Undo Group (gimp-undo-push-group-end image) ; Refresh the GIMP Display (gimp-displays-flush) ; Resets previous user settings (gimp-context-pop) ) ) (script-fu-register "script-fu-tech-background" "/Filters/Render/Tech Background..." "Create a simple tech-style background with a raised box effect." "Art Wade" "Art Wade" "February 2008" "RGB*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-COLOR "Background Color" '(43 108 126) SF-ADJUSTMENT "Block Size" '(10 2 100 1 10 0 1) )