1
1
; HIGHLIGHT-DROP-SHADOW-LOGO
2
2
; draw the specified text over a background with a drop shadow and a highlight
4
(define (color-highlight color)
9
(set! r (+ r (* (- 255 r) 0.75)))
10
(set! g (+ g (* (- 255 g) 0.75)))
11
(set! b (+ b (* (- 255 b) 0.75)))
14
4
(define (apply-basic2-logo-effect img
18
(let* ((width (car (gimp-drawable-width logo-layer)))
19
(height (car (gimp-drawable-height logo-layer)))
20
(posx (- (car (gimp-drawable-offsets logo-layer))))
21
(posy (- (cadr (gimp-drawable-offsets logo-layer))))
22
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
23
(highlight-layer (car (gimp-layer-copy logo-layer TRUE)))
24
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE))))
9
(define (color-highlight color)
16
(set! r (+ r (* (- 255 r) 0.75)))
17
(set! g (+ g (* (- 255 g) 0.75)))
18
(set! b (+ b (* (- 255 b) 0.75)))
24
(width (car (gimp-drawable-width logo-layer)))
25
(height (car (gimp-drawable-height logo-layer)))
26
(posx (- (car (gimp-drawable-offsets logo-layer))))
27
(posy (- (cadr (gimp-drawable-offsets logo-layer))))
28
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
29
(highlight-layer (car (gimp-layer-copy logo-layer TRUE)))
30
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE)))
26
33
(gimp-context-push)
31
38
(gimp-image-add-layer img shadow-layer 1)
32
39
(gimp-image-add-layer img highlight-layer 1)
33
40
(gimp-context-set-foreground text-color)
34
(gimp-layer-set-preserve-trans logo-layer TRUE)
41
(gimp-layer-set-lock-alpha logo-layer TRUE)
35
42
(gimp-edit-fill logo-layer FOREGROUND-FILL)
36
43
(gimp-edit-clear shadow-layer)
37
44
(gimp-context-set-foreground (color-highlight text-color))
38
(gimp-layer-set-preserve-trans highlight-layer TRUE)
45
(gimp-layer-set-lock-alpha highlight-layer TRUE)
39
46
(gimp-edit-fill highlight-layer FOREGROUND-FILL)
40
47
(gimp-context-set-background bg-color)
41
48
(gimp-drawable-fill bg-layer BACKGROUND-FILL)
47
54
(gimp-context-set-foreground '(255 255 255))
49
56
(gimp-edit-blend logo-layer FG-BG-RGB-MODE MULTIPLY-MODE
50
GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE
57
GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE
54
61
(gimp-layer-translate shadow-layer 3 3)
55
62
(gimp-layer-translate highlight-layer (- posx 2) (- posy 2))
56
63
(gimp-drawable-set-name highlight-layer "Highlight")
60
69
(define (script-fu-basic2-logo-alpha img
65
74
(gimp-image-undo-group-start img)
66
75
(apply-basic2-logo-effect img logo-layer bg-color text-color)
67
76
(gimp-image-undo-group-end img)
68
(gimp-displays-flush)))
70
81
(script-fu-register "script-fu-basic2-logo-alpha"
72
"Creates a simple logo with a shadow and a highlight"
78
SF-DRAWABLE "Drawable" 0
79
SF-COLOR _"Background color" '(255 255 255)
80
SF-COLOR _"Text color" '(206 6 50))
82
(script-fu-menu-register "script-fu-basic2-logo-alpha"
83
_"<Image>/Script-Fu/Alpha to Logo")
83
_"Add a shadow and a highlight to the selected region (or alpha)"
89
SF-DRAWABLE "Drawable" 0
90
SF-COLOR _"Background color" "white"
91
SF-COLOR _"Text color" '(206 6 50)
86
94
(define (script-fu-basic2-logo text
91
(let* ((img (car (gimp-image-new 256 256 RGB)))
92
(text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font))))
100
(img (car (gimp-image-new 256 256 RGB)))
101
(text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))
94
104
(gimp-image-undo-disable img)
95
(gimp-drawable-set-name text-layer text)
96
105
(apply-basic2-logo-effect img text-layer bg-color text-color)
97
106
(gimp-image-undo-enable img)
98
(gimp-display-new img)))
107
(gimp-display-new img)
111
(script-fu-menu-register "script-fu-basic2-logo-alpha"
112
"<Image>/Filters/Alpha to Logo")
100
114
(script-fu-register "script-fu-basic2-logo"
102
"Creates a simple logo with a shadow and a highlight"
107
SF-STRING _"Text" "SCRIPT-FU"
108
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
109
SF-FONT _"Font" "Sans Bold"
110
SF-COLOR _"Background color" '(255 255 255)
111
SF-COLOR _"Text color" '(206 6 50))
116
_"Create a simple logo with a shadow and a highlight"
121
SF-STRING _"Text" "SCRIPT-FU"
122
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
123
SF-FONT _"Font" "Sans Bold"
124
SF-COLOR _"Background color" "white"
125
SF-COLOR _"Text color" '(206 6 50)
113
128
(script-fu-menu-register "script-fu-basic2-logo"
114
_"<Toolbox>/Xtns/Script-Fu/Logos")
129
"<Toolbox>/Xtns/Logos")