coolmetal-logo.scm 4.52 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
;  COOL-METAL
;  Create a text effect that looks like metal with a reflection of
;  the horizon, a reflection of the text in the mirrored ground, and
;  an interesting dropshadow
;  This script was inspired by Rob Malda's 'coolmetal.gif' graphic

(define (script-fu-cool-metal-logo text size font bg-color seascape)
  (let* ((img (car (gimp-image-new 256 256 RGB)))
	 (feather (/ size 5))
	 (smear 7.5)
	 (period (/ size 3))
	 (amplitude (/ size 40))
	 (shrink (+ 1 (/ size 30)))
	 (depth (/ size 20))
15
	 (text-layer (car (gimp-text-fontname img -1 0 0 text 0 TRUE size PIXELS font)))
Elliot Lee's avatar
Elliot Lee committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
	 (width (car (gimp-drawable-width text-layer)))
	 (height (car (gimp-drawable-height text-layer)))
	 (img-width (+ width (* 0.15 height) 10))
	 (img-height (+ (* 1.85 height) 10))
	 (bg-layer (car (gimp-layer-new img img-width img-height RGB_IMAGE "Background" 100 NORMAL)))
	 (shadow-layer (car (gimp-layer-new img img-width img-height RGBA_IMAGE "Shadow" 100 NORMAL)))
	 (reflect-layer (car (gimp-layer-new img width height RGBA_IMAGE "Reflection" 100 NORMAL)))
	 (channel 0)
	 (fs 0)
	 (layer-mask 0)
	 (old-gradient (car (gimp-gradients-get-active)))
	 (old-fg (car (gimp-palette-get-foreground)))
	 (old-bg (car (gimp-palette-get-background))))
    (gimp-image-disable-undo img)
    (gimp-image-resize img img-width img-height 0 0)
    (gimp-image-add-layer img bg-layer 1)
    (gimp-image-add-layer img reflect-layer 1)
    (gimp-image-add-layer img shadow-layer 1)
    (gimp-layer-set-preserve-trans text-layer TRUE)

    (gimp-palette-set-background bg-color)
37 38
    (gimp-edit-fill bg-layer)
    (gimp-edit-clear reflect-layer)
Elliot Lee's avatar
Elliot Lee committed
39
    (gimp-palette-set-background '(0 0 0))
40
    (gimp-edit-fill shadow-layer)
Elliot Lee's avatar
Elliot Lee committed
41 42 43 44

    (if (= seascape 1)
	(gimp-gradients-set-active "Horizon_2")
	(gimp-gradients-set-active "Horizon_1"))
45
    (gimp-blend text-layer CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 0 0 0 (+ height 5))
Elliot Lee's avatar
Elliot Lee committed
46 47 48 49 50 51 52
    (gimp-rect-select img 0 (- (/ height 2) feather) img-width (* 2 feather) REPLACE 0 0)
    (plug-in-gauss-iir 1 img text-layer smear TRUE TRUE)
    (gimp-selection-none img)
    (plug-in-ripple 1 img text-layer period amplitude 1 0 1 TRUE FALSE)
    (gimp-layer-translate text-layer 5 5)
    (gimp-layer-resize text-layer img-width img-height 5 5)

53
    (gimp-selection-layer-alpha text-layer)
Elliot Lee's avatar
Elliot Lee committed
54 55 56 57
    (set! channel (car (gimp-selection-save img)))
    (gimp-selection-shrink img shrink)
    (gimp-selection-invert img)
    (plug-in-gauss-rle 1 img channel feather TRUE TRUE)
58
    (gimp-selection-layer-alpha text-layer)
Elliot Lee's avatar
Elliot Lee committed
59 60
    (gimp-selection-invert img)
    (gimp-palette-set-background '(0 0 0))
61
    (gimp-edit-fill channel)
Elliot Lee's avatar
Elliot Lee committed
62 63 64 65
    (gimp-selection-none img)

    (plug-in-bump-map 1 img text-layer channel 135 45 depth 0 0 0 0 FALSE FALSE 0)

66 67 68 69
    (gimp-selection-layer-alpha text-layer)
    (set! fs (car (gimp-selection-float shadow-layer 0 0)))
    (gimp-edit-clear shadow-layer)
    (gimp-perspective fs FALSE
Elliot Lee's avatar
Elliot Lee committed
70 71 72 73 74 75 76 77
		      (+ 5 (* 0.15 height)) (- height (* 0.15 height))
		      (+ 5 width (* 0.15 height)) (- height (* 0.15 height))
		      5 height
		      (+ 5 width) height)
    (gimp-floating-sel-anchor fs)
    (plug-in-gauss-rle 1 img shadow-layer smear TRUE TRUE)

    (gimp-rect-select img 5 5 width height REPLACE FALSE 0)
78 79
    (gimp-edit-copy text-layer)
    (set! fs (car (gimp-edit-paste reflect-layer FALSE)))
Elliot Lee's avatar
Elliot Lee committed
80
    (gimp-floating-sel-anchor fs)
81
    (gimp-scale reflect-layer FALSE 0 0 width (* 0.85 height))
82
    (gimp-flip reflect-layer 1)
Elliot Lee's avatar
Elliot Lee committed
83 84 85 86 87 88
    (gimp-layer-set-offsets reflect-layer 5 (+ 3 height))

    (set! layer-mask (car (gimp-layer-create-mask reflect-layer WHITE-MASK)))
    (gimp-image-add-layer-mask img reflect-layer layer-mask)
    (gimp-palette-set-foreground '(255 255 255))
    (gimp-palette-set-background '(0 0 0))
89
    (gimp-blend layer-mask FG-BG-RGB NORMAL LINEAR 100 0 REPEAT-NONE
Elliot Lee's avatar
Elliot Lee committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
		FALSE 0 0 0 (- (/ height 2)) 0 height)

    (gimp-image-remove-channel img channel)

    (gimp-layer-set-name text-layer text)
    (gimp-gradients-set-active old-gradient)
    (gimp-palette-set-background old-bg)
    (gimp-palette-set-foreground old-fg)
    (gimp-image-enable-undo img)
    (gimp-display-new img)))


(script-fu-register "script-fu-cool-metal-logo"
		    "<Toolbox>/Xtns/Script-Fu/Logos/Cool Metal"
		    "Metallic logos with reflections and perspective shadows"
		    "Spencer Kimball & Rob Malda"
		    "Spencer Kimball & Rob Malda"
		    "1997"
		    ""
109
		    SF-STRING "Text String" "Cool Metal"
110 111
		    SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
		    SF-FONT "Font" "-*-Crillee-*-r-*-*-24-*-*-*-p-*-*-*"
Elliot Lee's avatar
Elliot Lee committed
112 113
		    SF-COLOR "Background Color" '(255 255 255)
		    SF-TOGGLE "Seascape" FALSE)