]> icculus.org git repositories - divverent/nexuiz.git/blob - misc/buildfiles/brand/nexbrand.sh
using Script-Fu to generate the branding image...
[divverent/nexuiz.git] / misc / buildfiles / brand / nexbrand.sh
1 #!/bin/sh
2
3 # usage: ./nexbrand.sh "2.0.1 RC 1" rc1
4 #   writes "2.0.1 RC 1" on rc1.tga
5 # NOTE: unfortunately requires X-server (otherwise file-tga-save won't work... no joke)
6
7 version=$1
8 versiontag=$2
9
10 gimp -i -b - <<EOF
11
12 (define (nexuiz-brand-image img text size font)
13         (let*(
14                         (border (/ size 4))
15                         (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
16                         (grow (/ size 4))
17                         (feather1 (/ size 3))
18                         (feather2 (/ size 7))
19                         (feather3 (/ size 10))
20                         (width (car (gimp-drawable-width text-layer)))
21                         (height (car (gimp-drawable-height text-layer)))
22                         (posx (- (car (gimp-drawable-offsets text-layer))))
23                         (posy (- (cadr (gimp-drawable-offsets text-layer))))
24                         (glow-layer (car (gimp-layer-copy text-layer TRUE)))
25                 )
26                 (gimp-layer-resize text-layer width (+ 36 height) 0 0)
27                 (gimp-image-resize img width (+ 36 height) 0 0)
28                 (gimp-image-resize-to-layers img)
29                 (gimp-image-add-layer img glow-layer 1)
30                 (gimp-layer-translate glow-layer posx posy)
31                 (gimp-selection-none img)
32                 (gimp-layer-set-preserve-trans text-layer TRUE)
33                 (gimp-context-set-background '(0 0 0))
34                 (gimp-edit-fill text-layer BACKGROUND-FILL)
35                 (gimp-selection-layer-alpha text-layer)
36                 (gimp-selection-feather img feather1)
37                 (gimp-context-set-background '(221 0 0))
38                 (gimp-edit-fill glow-layer BACKGROUND-FILL)
39                 (gimp-edit-fill glow-layer BACKGROUND-FILL)
40                 (gimp-edit-fill glow-layer BACKGROUND-FILL)
41                 (gimp-selection-layer-alpha text-layer)
42                 (gimp-selection-feather img feather2)
43                 (gimp-context-set-background '(232 217 18))
44                 (gimp-edit-fill glow-layer BACKGROUND-FILL)
45                 (gimp-edit-fill glow-layer BACKGROUND-FILL)
46                 (gimp-selection-layer-alpha text-layer)
47                 (gimp-selection-feather img feather3)
48                 (gimp-context-set-background '(255 255 255))
49                 (gimp-edit-fill glow-layer BACKGROUND-FILL)
50                 (gimp-selection-none img)
51                 (gimp-drawable-set-name glow-layer "Glow Layer")
52         )
53 )
54
55 (let*(
56                 (img (car (gimp-image-new 256 256 RGB)))
57         )
58         (gimp-image-undo-disable img)
59         (nexuiz-brand-image img "$version" 24 "Bitstream Vera Sans Bold")
60         (gimp-image-merge-visible-layers img 1)
61         (file-tga-save RUN-NONINTERACTIVE img (car (gimp-image-active-drawable img)) "$versiontag.tga" "$versiontag.tga" 1 1)
62         (gimp-quit 0)
63 )
64
65 EOF