Graphics update.
[dcpomatic.git] / graphics / update
1 #!/bin/bash
2 #
3 # Update generated stuff in graphics/ from the source files.
4 #
5 # It would be nice to do this with waf but:
6 # a) getting the wscript right is a complete pain in the arse
7 # b) running Inkscape from the command line on OS X is a complete pain in the arse
8
9 pwd=`pwd`
10 if [ `basename $pwd` != "graphics" ]; then
11     echo "$0: run within graphics/"
12     exit 1
13 fi
14
15 for c in icotool convert inkscape; do
16     if [ ! -x "$(command -v $c)" ]; then
17         echo "$c is required"
18         exit 1
19     fi
20 done
21
22 if [ `uname -s` == "Darwin" ]; then
23     # Convert OS X icons using OS X-only iconutil
24     for p in dcpomatic2 dcpomatic2_kdm dcpomatic2_server dcpomatic2_batch dcpomatic2_player; do
25         iconutil --convert icns --output osx/$p.icns osx/$p.iconset
26     done
27 else
28     INKSCAPE="inkscape -z -C -e"
29
30     # OS X application icons
31     mkdir -p osx
32     for r in 16 32 128 256 512; do
33         for p in dcpomatic2; do
34             mkdir -p osx/$p.iconset
35             convert src/dcpomatic.png -resize $rx$r osx/$p.iconset/icon_${r}x${r}.png
36             convert src/dcpomatic.png -resize $rx$r osx/$p.iconset/icon_${r}x${r}@2x.png
37         done
38         for p in dcpomatic2_kdm dcpomatic2_server dcpomatic2_batch dcpomatic2_player; do
39             mkdir -p osx/$p.iconset
40             $INKSCAPE osx/$p.iconset/icon_${r}x${r}.png -w $r -h $r src/$p.svg
41             $INKSCAPE osx/$p.iconset/icon_${r}x${r}@2x.png -w $r -h $r src/$p.svg
42         done
43     done
44
45     # Linux application icons
46     mkdir -p linux
47     for r in 16 22 32 48 64 128 256 512; do
48         mkdir -p linux/$r
49         convert src/dcpomatic.png -resize $rx$r linux/$r/dcpomatic2.png
50         for p in dcpomatic2_kdm dcpomatic2_server dcpomatic2_batch dcpomatic2_player dcpomatic2_playlist; do
51             $INKSCAPE linux/$r/$p.png src/$p.svg -w $r -h $r
52         done
53     done
54
55     # Windows application icons
56     mkdir -p windows
57     for p in dcpomatic2 dcpomatic2_kdm dcpomatic2_server dcpomatic2_batch dcpomatic2_player dcpomatic2_playlist; do
58         icotool -c -o windows/$p.ico linux/16/$p.png linux/32/$p.png linux/48/$p.png linux/64/$p.png linux/128/$p.png
59     done
60     convert src/dcpomatic.png -resize 400x400 windows/dcpomatic.bmp
61
62     # OS X preferences icons
63     # servers.png does not have an SVG version
64     mkdir -p osx/preferences
65     for i in colour_conversions defaults email kdm_email cover_sheet keys tms notifications accounts locations; do
66         $INKSCAPE osx/preferences/$i.png src/$i.svg -w 32 -h 32
67     done
68
69     # OS X menu bar icon for the server
70     $INKSCAPE osx/dcpomatic_small.png -w 64 -h 64 src/dcpomatic_small.svg
71
72     # Splash screen (all platforms)
73     $INKSCAPE splash.png src/splash.svg -w 400 -h 300
74
75     # Timeline toolbar icons (all platforms)
76     for i in select zoom zoom_all snap sequence; do
77         $INKSCAPE $i.png src/$i.svg -w 32 -h 32
78     done
79
80     # Playlist editor tick/no-tick
81     $INKSCAPE tick.png src/tick.svg -w 16 -h 16
82     $INKSCAPE no_tick.png src/no_tick.svg -w 16 -h 16
83
84     # favicon
85     mkdir -p web
86     convert src/web.png -resize 256x256 -transparent white web/favicon-256x256.png
87     for r in 16 32 64 128; do
88         convert web/favicon-256x256.png -resize $rx$r web/favicon-${r}x${r}.png
89     done
90     convert web/favicon-16x16.png web/favicon-32x32.png web/favicon-64x64.png web/favicon-128x128.png web/favicon-256x256.png web/favicon.ico
91     convert src/web.png -resize 123x123 -transparent white web/logo.png
92 fi