;; nugget-logo.scm --- create a gold nugget effect ;; Copyright (C) 2004 Ivan Zenkov ;; Maintainer: Ivan Zenkov ;; Keywords: alpha logo ;; 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. ;;; Commentary: ;; This is script create a gold nugget effect for images and text objects. ;;; Code: (define (apply-nugget-logo-effect image drawable gold-color azimuth depth) (let* ( (width (car (gimp-image-width image))) (height (car (gimp-image-height image)))) ;;; equal corrosion (set! ec-layer (car (gimp-layer-new image width height RGBA-IMAGE "Equal Corrosion" 100 NORMAL-MODE))) (gimp-image-add-layer image ec-layer -1) (gimp-edit-clear ec-layer) (gimp-selection-layer-alpha drawable) (plug-in-plasma TRUE image ec-layer (rand 4294967296) 1.3) (gimp-selection-none image) (gimp-desaturate ec-layer) (gimp-layer-set-mode ec-layer OVERLAY-MODE) (gimp-brightness-contrast ec-layer -50 55) ;;; pitting corrosion (set! pc-layer (car (gimp-layer-new image width height RGBA-IMAGE "Pitting Corrosion" 100 NORMAL-MODE))) (gimp-image-add-layer image pc-layer -1) (gimp-edit-clear pc-layer) (gimp-selection-layer-alpha drawable) (plug-in-plasma TRUE image pc-layer (rand 4294967296) 1.3) (gimp-selection-none image) (gimp-threshold pc-layer 100 150) (if (= (rand 2) 1) (gimp-by-color-select pc-layer '(0 0 0) 0 0 TRUE 0 0 0) (gimp-by-color-select pc-layer '(255 255 255) 0 0 TRUE 0 0 0)) (gimp-edit-cut pc-layer) (gimp-selection-layer-alpha pc-layer) (plug-in-plasma TRUE image pc-layer (rand 4294967296) 1.3) (gimp-selection-none image) (gimp-desaturate pc-layer) (gimp-layer-set-mode pc-layer BURN-MODE) (plug-in-bump-map 1 image drawable pc-layer azimuth 45 depth 0 0 0 0 TRUE TRUE LINEAR) (gimp-posterize pc-layer 5) (gimp-color-balance pc-layer MIDTONES TRUE 100 0 0) (gimp-color-balance pc-layer HIGHLIGHTS TRUE 0 50 0) (set! gold-layer (car (gimp-image-merge-down image ec-layer CLIP-TO-BOTTOM-LAYER))) (set! gold-layer (car (gimp-image-merge-down image pc-layer CLIP-TO-BOTTOM-LAYER))))) (define (script-fu-nugget-logo-alpha image drawable bg-color gold-color azimuth depth shadow) (let* ((width (car (gimp-image-width image))) (height (car (gimp-image-height image))) (old-fg (car (gimp-palette-get-foreground))) (old-bg (car (gimp-palette-get-background)))) (gimp-image-undo-group-start image) ;;; background (set! bg-layer (car (gimp-layer-new image width height RGB-IMAGE "Background" 100 NORMAL-MODE))) (gimp-image-add-layer image bg-layer -1) (gimp-palette-set-background bg-color) (gimp-edit-clear bg-layer) ;;; gold surface (set! gold-layer (car (gimp-layer-new image width height RGBA-IMAGE "Gold Surface" 100 NORMAL-MODE))) (gimp-image-add-layer image gold-layer -1) (gimp-edit-clear gold-layer) (gimp-selection-layer-alpha drawable) (gimp-palette-set-foreground gold-color) (gimp-edit-fill gold-layer FOREGROUND-FILL) (gimp-selection-none image) ;;; gold (apply-nugget-logo-effect image gold-layer gold-color azimuth depth) ;;; shadow (if (= shadow TRUE) (script-fu-drop-shadow image gold-layer 0 0 10 '(0 0 0) 80 0)) (gimp-palette-set-foreground old-fg) (gimp-palette-set-background old-bg) (gimp-image-undo-group-end image) (gimp-displays-flush))) (script-fu-register "script-fu-nugget-logo-alpha" "/Script-Fu/Alpha to Logo/Nugget..." "Create a gold nugget effect" "Ivan Zenkov" "Ivan Zenkov" "October 8, 2004" "RGBA" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-COLOR _"Background Color" '(102 102 102) SF-COLOR _"Gold Color" '(225 216 181) SF-ADJUSTMENT _"Azimuth" '(135 0 360 1 0 2 0) SF-ADJUSTMENT _"Depth" '(3 0 10 1 0 0 0) SF-TOGGLE _"Shadow" TRUE) (define (script-fu-nugget-logo string font-name font-size gold-color bg-color azimuth depth shadow) (let* ((image (car (gimp-image-new 256 256 RGB))) (bg-layer (car (gimp-layer-new image 256 256 RGB-IMAGE "Background" 100 NORMAL-MODE))) (text-border (/ font-size 4)) (old-fg (car (gimp-palette-get-foreground))) (old-bg (car (gimp-palette-get-background)))) (gimp-image-undo-disable image) ;;; background (gimp-image-add-layer image bg-layer 0) (gimp-palette-set-background bg-color) (gimp-edit-clear bg-layer) ;;; text color (set! text-layer (car (gimp-text-fontname image -1 0 0 string text-border TRUE font-size PIXELS font-name))) (gimp-drawable-set-name text-layer "Text Layer") (script-fu-util-image-resize-from-layer image text-layer) (gimp-selection-layer-alpha text-layer) (gimp-palette-set-foreground gold-color) (gimp-edit-fill text-layer FOREGROUND-FILL) (gimp-selection-none image) (gimp-layer-resize-to-image-size bg-layer) ;;; nugget effect (set! text-layer (apply-nugget-logo-effect image text-layer gold-color azimuth depth)) ;;; shadow (if (= shadow TRUE) (script-fu-drop-shadow image text-layer 0 0 10 '(0 0 0) 80 0)) (gimp-palette-set-foreground old-fg) (gimp-palette-set-background old-bg) (gimp-image-undo-enable image) (gimp-display-new image))) (script-fu-register "script-fu-nugget-logo" "/Xtns/Script-Fu/Logos/Nugget..." "Create a gold nugget effect" "Ivan Zenkov" "Ivan Zenkov" "October 8, 2004" "" SF-STRING _"Text" "Nugget" SF-FONT _"Font" "Sumdumgoi" SF-ADJUSTMENT _"Font Size (pixels)" '(70 2 1000 1 10 0 1) SF-COLOR _"Gold Color" '(225 216 181) SF-COLOR _"Background Color" '(102 102 102) SF-ADJUSTMENT _"Azimuth" '(135 0 360 1 0 2 0) SF-ADJUSTMENT _"Depth" '(3 0 10 1 0 0 0) SF-TOGGLE _"Shadow" TRUE) ;;; nugget-logo.scm ends here