1
; The GIMP -- an image manipulation program
2
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
; alien-neon-logo.scm - creates multiple outlines around the letters
5
; Copyright (C) 1999-2000 Raphael Quinet <quinet@gamers.org>
7
; This program is free software; you can redistribute it and/or modify
8
; it under the terms of the GNU General Public License as published by
9
; the Free Software Foundation; either version 2 of the License, or
10
; (at your option) any later version.
12
; This program is distributed in the hope that it will be useful,
13
; but WITHOUT ANY WARRANTY; without even the implied warranty of
14
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
; GNU General Public License for more details.
17
; You should have received a copy of the GNU General Public License
18
; along with this program; if not, write to the Free Software
19
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
; 1999-12-01 First version.
22
; 2000-02-19 Do not discard the layer mask so that it can still be edited.
23
; 2000-03-08 Adapted the script to my gimp-edit-fill changes.
24
; 2000-04-02 Split the script in two parts: one using text, one using alpha.
25
; 2000-05-29 More modifications for "Alpha to Logo" using a separate function.
27
; To do: use a channel mask for creating the bands, instead of working in the
28
; image. gimp-invert would then work on one grayscale channel instead of
29
; wasting CPU cycles on three identical R, G, B channels.
32
(define (apply-alien-neon-logo-effect img
40
(let* ((fade-size (- (* (+ band-size gap-size) num-bands) 1))
41
(width (car (gimp-drawable-width logo-layer)))
42
(height (car (gimp-drawable-height logo-layer)))
43
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
44
(bands-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bands" 100 NORMAL-MODE))))
48
(script-fu-util-image-resize-from-layer img logo-layer)
49
(gimp-image-add-layer img bg-layer 1)
50
(gimp-image-add-layer img bands-layer 1)
51
(gimp-selection-none img)
52
(gimp-context-set-background bg-color)
53
(gimp-edit-fill bg-layer BACKGROUND-FILL)
54
(gimp-context-set-background '(0 0 0))
55
(gimp-edit-fill bands-layer BACKGROUND-FILL)
56
; The text layer is never shown: it is only used to create a selection
57
(gimp-selection-layer-alpha logo-layer)
58
(gimp-context-set-foreground '(255 255 255))
59
(gimp-edit-fill bands-layer FOREGROUND-FILL)
61
; Create multiple outlines by growing and inverting the selection
62
; The bands are black and white because they will be used as a mask.
63
(while (> num-bands 0)
64
(gimp-selection-grow img band-size)
65
(gimp-invert bands-layer)
66
(gimp-selection-grow img gap-size)
67
(gimp-invert bands-layer)
68
(set! num-bands (- num-bands 1)))
70
; The fading effect is obtained by masking the image with a gradient.
71
; The gradient is created by filling a bordered selection (white->black).
73
(let ((bands-layer-mask (car (gimp-layer-create-mask bands-layer
75
(gimp-layer-add-mask bands-layer bands-layer-mask)
76
(gimp-selection-layer-alpha logo-layer)
77
(gimp-selection-border img fade-size)
78
(gimp-edit-fill bands-layer-mask FOREGROUND-FILL)
79
(gimp-layer-remove-mask bands-layer MASK-APPLY)))
81
; Transfer the resulting grayscale bands into the layer mask.
82
(let ((bands-layer-mask (car (gimp-layer-create-mask bands-layer
84
(gimp-layer-add-mask bands-layer bands-layer-mask)
85
(gimp-selection-none img)
86
(gimp-edit-copy bands-layer)
87
(gimp-floating-sel-anchor (car (gimp-edit-paste bands-layer-mask
90
; Fill the layer with the foreground color. The areas that are not
91
; masked become visible.
92
(gimp-context-set-foreground fg-color)
93
(gimp-edit-fill bands-layer FOREGROUND-FILL)
94
;; (gimp-layer-remove-mask bands-layer MASK-APPLY)
97
(gimp-drawable-set-visible logo-layer 0)
98
(gimp-image-set-active-layer img bands-layer)
103
(define (script-fu-alien-neon-logo-alpha img
112
(gimp-image-undo-group-start img)
113
(apply-alien-neon-logo-effect img logo-layer fg-color bg-color
114
band-size gap-size num-bands do-fade)
115
(gimp-image-undo-group-end img)
116
(gimp-displays-flush)))
118
(script-fu-register "script-fu-alien-neon-logo-alpha"
120
"Creates a psychedelic effect with outlines of the specified color around the letters"
121
"Raphael Quinet (quinet@gamers.org)"
126
SF-DRAWABLE "Drawable" 0
127
SF-COLOR _"Glow color" '(0 255 0)
128
SF-COLOR _"Background color" '(0 0 0)
129
SF-ADJUSTMENT _"Width of bands" '(2 1 60 1 10 0 0)
130
SF-ADJUSTMENT _"Width of gaps" '(2 1 60 1 10 0 0)
131
SF-ADJUSTMENT _"Number of bands" '(7 1 100 1 10 0 1)
132
SF-TOGGLE _"Fade away" TRUE)
134
(script-fu-menu-register "script-fu-alien-neon-logo-alpha"
135
_"<Image>/Script-Fu/Alpha to Logo")
138
(define (script-fu-alien-neon-logo text
147
(let* ((img (car (gimp-image-new 256 256 RGB)))
148
(fade-size (- (* (+ band-size gap-size) num-bands) 1))
149
(text-layer (car (gimp-text-fontname img -1 0 0 text (+ fade-size 10) TRUE size PIXELS fontname))))
150
(gimp-image-undo-disable img)
151
(gimp-drawable-set-name text-layer text)
152
(apply-alien-neon-logo-effect img text-layer fg-color bg-color
153
band-size gap-size num-bands do-fade)
154
(gimp-image-undo-enable img)
155
(gimp-display-new img)))
157
(script-fu-register "script-fu-alien-neon-logo"
159
"Creates a psychedelic effect with outlines of the specified color around the letters"
160
"Raphael Quinet (quinet@gamers.org)"
164
SF-STRING _"Text" "The GIMP"
165
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
166
SF-FONT _"Font" "Blippo"
167
SF-COLOR _"Glow color" '(0 255 0)
168
SF-COLOR _"Background color" '(0 0 0)
169
SF-ADJUSTMENT _"Width of bands" '(2 1 60 1 10 0 0)
170
SF-ADJUSTMENT _"Width of gaps" '(2 1 60 1 10 0 0)
171
SF-ADJUSTMENT _"Number of bands" '(7 1 100 1 10 0 1)
172
SF-TOGGLE _"Fade away" TRUE)
174
(script-fu-menu-register "script-fu-alien-neon-logo"
175
_"<Toolbox>/Xtns/Script-Fu/Logos")