]> git.tuebingen.mpg.de Git - dss.git/blob - mklogo
d4705ba7b9f91ae37df8f6f87cce30bfe8284833
[dss.git] / mklogo
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3
4 # Script for Image Magick that writes the dss logo in png format
5 # to stdout.
6
7 set -u
8
9 width=320
10 height=110
11 border=5
12 radius1=4
13 radius2=5
14 circle_y=90
15 arrow_y=70
16 text_x=128
17 text_y=55
18 pointsize=36
19
20 declare -a circle arrow rectangle text
21
22 make_circles()
23 {
24         local inner='stroke black fill red circle'
25         local outer='stroke black fill black circle'
26         local num=1
27         local idx=0
28         local y=$circle_y
29         local step x0 i j idx num
30
31         for ((i = 0; i < 4; i++)); do
32                 step=$(((width / 4 + num) / (num + 1)))
33                 x0=$((border + width / 4 * i))
34                 for ((j = 1; j <= $num; j++)); do
35                         x=$((x0 + j * $step))
36                         circle[$idx]='-draw'; let idx++
37                         circle[$idx]="$outer $x,$y,$((x + radius2)),$y"; let idx++
38                         circle[$idx]='-draw'; let idx++
39                         circle[$idx]="$inner $x,$y,$((x + radius1)),$y"; let idx++
40                 done
41                 num=$((num * 2))
42         done
43         #echo "${circle[@]}"; exit 0
44 }
45
46 make_arrow()
47 {
48         local arrow_head='l -15,-5  +5,+5  -5,+5  +15,-5 z'
49         local idx=0
50         local x0 x1 y
51
52         arrow[$idx]='-draw'; let idx++
53         x0=$((3 * border)); x1=$((width - 2 * border))
54         y=$arrow_y
55         arrow[$idx]="stroke white line $x0,$y $x1,$y"; let idx++
56         arrow[$idx]='-draw'; let idx++
57         x0=$((width - 2 * border))
58         arrow[$idx]="stroke white fill white path 'M $x0,$y $arrow_head'"
59         #echo "${arrow[@]}"; exit 0
60 }
61
62 make_rectangles()
63 {
64         local idx=0
65         local x x0 x1 y y0 y1 i red_green color
66
67         rectangle[$idx]='-draw'; let idx++
68         x=$((width + 2 * border))
69         y=$((height + 2 * border))
70         rectangle[$idx]="stroke yellow fill yellow rectangle 0,0 $x,$y"; let idx++
71         for ((i = 0; i < 4; i++)); do
72                 rectangle[$idx]='-draw'; let idx++
73                 red_green="$(printf '%02x' $(((3 - i) * 60)))"
74                 color="#${red_green}${red_green}ff"
75                 x0=$((border + i * width / 4)); x1=$((x0 + width / 4 - 1))
76                 y0=$border; y1=$((y0 + height))
77                 rectangle[$idx]="stroke $color fill $color rectangle $x0,$y0 $x1,$y1"
78                 let idx++
79         done
80         #echo "${rectangle[@]}"; exit 0
81 }
82
83 make_text()
84 {
85         text=(-pointsize $pointsize -draw \
86                 "fill white text $text_x,$text_y DSS")
87         #echo "${text[@]}"; exit 0
88 }
89
90 make_rectangles
91 make_arrow
92 make_circles
93 make_text
94
95 convert -size $((width + 2 * border))x$((height + 2 * border)) \
96         -background none xc: \
97         "${rectangle[@]}" \
98         "${arrow[@]}" \
99         "${circle[@]}" \
100         "${text[@]}" \
101         png:-