coolmetal-logo.scm 5.68 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2 3 4 5 6
;  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

7 8 9 10 11 12
(define (apply-cool-metal-logo-effect img
				      logo-layer
				      size
				      bg-color
				      gradient)
  (let* ((feather (/ size 5))
Elliot Lee's avatar
Elliot Lee committed
13 14 15 16 17
	 (smear 7.5)
	 (period (/ size 3))
	 (amplitude (/ size 40))
	 (shrink (+ 1 (/ size 30)))
	 (depth (/ size 20))
18 19
	 (width (car (gimp-drawable-width logo-layer)))
	 (height (car (gimp-drawable-height logo-layer)))
20 21
	 (posx (- (car (gimp-drawable-offsets logo-layer))))
	 (posy (- (cadr (gimp-drawable-offsets logo-layer))))
Elliot Lee's avatar
Elliot Lee committed
22 23 24 25 26 27 28 29
	 (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)
30
	 (old-gradient (car (gimp-gradients-get-gradient)))
Elliot Lee's avatar
Elliot Lee committed
31 32
	 (old-fg (car (gimp-palette-get-foreground)))
	 (old-bg (car (gimp-palette-get-background))))
33 34
    (gimp-selection-none img)
    (gimp-image-resize img img-width img-height posx posy)
Elliot Lee's avatar
Elliot Lee committed
35 36 37
    (gimp-image-add-layer img bg-layer 1)
    (gimp-image-add-layer img reflect-layer 1)
    (gimp-image-add-layer img shadow-layer 1)
38
    (gimp-layer-set-preserve-trans logo-layer TRUE)
Elliot Lee's avatar
Elliot Lee committed
39 40

    (gimp-palette-set-background bg-color)
41
    (gimp-edit-fill bg-layer BG-IMAGE-FILL)
42
    (gimp-edit-clear reflect-layer)
Elliot Lee's avatar
Elliot Lee committed
43
    (gimp-palette-set-background '(0 0 0))
44
    (gimp-edit-fill shadow-layer BG-IMAGE-FILL)
Elliot Lee's avatar
Elliot Lee committed
45

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

55
    (gimp-selection-layer-alpha logo-layer)
Elliot Lee's avatar
Elliot Lee committed
56 57 58 59
    (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)
60
    (gimp-selection-layer-alpha logo-layer)
Elliot Lee's avatar
Elliot Lee committed
61 62
    (gimp-selection-invert img)
    (gimp-palette-set-background '(0 0 0))
63
    (gimp-edit-fill channel BG-IMAGE-FILL)
Elliot Lee's avatar
Elliot Lee committed
64 65
    (gimp-selection-none img)

66
    (plug-in-bump-map 1 img logo-layer channel 135 45 depth 0 0 0 0 FALSE FALSE 0)
Elliot Lee's avatar
Elliot Lee committed
67

68
    (gimp-selection-layer-alpha logo-layer)
69 70 71
    (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
72 73 74 75 76 77 78 79
		      (+ 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)
80
    (gimp-edit-copy logo-layer)
81
    (set! fs (car (gimp-edit-paste reflect-layer FALSE)))
Elliot Lee's avatar
Elliot Lee committed
82
    (gimp-floating-sel-anchor fs)
83
    (gimp-scale reflect-layer FALSE 0 0 width (* 0.85 height))
84
    (gimp-flip reflect-layer 1)
Elliot Lee's avatar
Elliot Lee committed
85 86 87 88 89 90
    (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))
91
    (gimp-blend layer-mask FG-BG-RGB NORMAL LINEAR 100 0 REPEAT-NONE
Elliot Lee's avatar
Elliot Lee committed
92 93 94 95
		FALSE 0 0 0 (- (/ height 2)) 0 height)

    (gimp-image-remove-channel img channel)

96
    (gimp-gradients-set-gradient old-gradient)
Elliot Lee's avatar
Elliot Lee committed
97
    (gimp-palette-set-background old-bg)
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
    (gimp-palette-set-foreground old-fg)))


(define (script-fu-cool-metal-logo-alpha img
					 logo-layer
					 size
					 bg-color
					 gradient)
  (begin
    (gimp-undo-push-group-start img)
    (apply-cool-metal-logo-effect img logo-layer size bg-color gradient)
    (gimp-undo-push-group-end img)
    (gimp-displays-flush)))

(script-fu-register "script-fu-cool-metal-logo-alpha"
		    _"<Image>/Script-Fu/Alpha to Logo/Cool Metal..."
		    "Metallic logos with reflections and perspective shadows"
		    "Spencer Kimball & Rob Malda"
		    "Spencer Kimball & Rob Malda"
		    "1997"
		    "RGBA"
                    SF-IMAGE      "Image" 0
                    SF-DRAWABLE   "Drawable" 0
		    SF-ADJUSTMENT _"Effect Size (pixels)" '(100 2 1000 1 10 0 1)
		    SF-COLOR      _"Background Color" '(255 255 255)
123
		    SF-GRADIENT   _"Gradient" "Horizon 1"
124 125 126 127 128 129 130 131 132 133 134 135 136
		    )


(define (script-fu-cool-metal-logo text
				   size
				   font
				   bg-color
				   gradient)
  (let* ((img (car (gimp-image-new 256 256 RGB)))
	 (text-layer (car (gimp-text-fontname img -1 0 0 text 0 TRUE size PIXELS font))))
    (gimp-image-undo-disable img)
    (gimp-layer-set-name text-layer text)
    (apply-cool-metal-logo-effect img text-layer size bg-color gradient)
Marc Lehmann's avatar
Marc Lehmann committed
137
    (gimp-image-undo-enable img)
Elliot Lee's avatar
Elliot Lee committed
138 139 140
    (gimp-display-new img)))

(script-fu-register "script-fu-cool-metal-logo"
141
		    _"<Toolbox>/Xtns/Script-Fu/Logos/Cool Metal..."
Elliot Lee's avatar
Elliot Lee committed
142 143 144 145 146
		    "Metallic logos with reflections and perspective shadows"
		    "Spencer Kimball & Rob Malda"
		    "Spencer Kimball & Rob Malda"
		    "1997"
		    ""
147 148
		    SF-STRING     _"Text" "Cool Metal"
		    SF-ADJUSTMENT _"Font Size (pixels)" '(100 2 1000 1 10 0 1)
149
		    SF-FONT       _"Font" "Crillee"
150
		    SF-COLOR      _"Background Color" '(255 255 255)
151
		    SF-GRADIENT   _"Gradient" "Horizon 1"
152
		    )