-
Notifications
You must be signed in to change notification settings - Fork 5
/
pistos-outline-text.scm
71 lines (60 loc) · 1.86 KB
/
pistos-outline-text.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
(script-fu-register
"script-fu-outline-text"
"Outline Text" ;menu label
"Outlines text with a feathered outline using the current background colour. Version 1.2.0" ;description
"Pistos" ;author
"Copyright 2016-2020, Pistos" ;copyright notice
"2016-05-31" ;date created
"" ;image type that the script works on
SF-IMAGE "image" -1 ; "Input image"
SF-DRAWABLE "layer" -1 ; "Input layer"
SF-VALUE "outlineSize" "10" ; "Size of outline (in pixels):"
SF-VALUE "layerOpacity" "70" ; "Opacity of new layer (in percent):"
)
(script-fu-menu-register "script-fu-outline-text" "<Image>/Filters/Light and Shadow")
(define (script-fu-outline-text image layer outlineSize layerOpacity)
(gimp-progress-init
(string-append
"Outlining text on layer '"
(car (gimp-item-get-name layer))
"'..."
)
-1 ; separate window
)
(let*
(
(colour -1)
(activeLayer -1)
(newLayer -1)
)
(gimp-undo-push-group-start image)
(set! activeLayer
(car (gimp-image-get-active-layer image))
)
(set! colour
(car (gimp-text-layer-get-color layer))
)
(gimp-image-select-color image CHANNEL-OP-ADD activeLayer colour)
(gimp-selection-grow image outlineSize)
(set! newLayer
(car (gimp-layer-new
image
(car (gimp-image-width image))
(car (gimp-image-height image))
RGBA-IMAGE
(string-append
"Outline of "
(car (gimp-item-get-name layer))
)
layerOpacity
0
))
)
(gimp-image-insert-layer image newLayer -1 1)
(gimp-selection-feather image outlineSize)
(gimp-edit-fill newLayer BACKGROUND-FILL)
(gimp-selection-none image)
(gimp-undo-push-group-end image)
(gimp-displays-flush)
)
)