Tweak the cropping of the Filling icon very slightly.
[sgt/puzzles] / icons / Makefile
... / ...
CommitLineData
1# Makefile for Puzzles icons.
2
3PUZZLES = blackbox bridges cube dominosa fifteen filling flip galaxies guess \
4 inertia lightup loopy map mines net netslide pattern pegs rect \
5 samegame sixteen slant solo tents twiddle unequal untangle
6
7BASE = $(patsubst %,%-base.png,$(PUZZLES))
8WEB = $(patsubst %,%-web.png,$(PUZZLES))
9
10IBASE = $(patsubst %,%-ibase.png,$(PUZZLES))
11IBASE4 = $(patsubst %,%-ibase4.png,$(PUZZLES))
12P48D24 = $(patsubst %,%-48d24.png,$(PUZZLES))
13P48D8 = $(patsubst %,%-48d8.png,$(PUZZLES))
14P48D4 = $(patsubst %,%-48d4.png,$(PUZZLES))
15P32D24 = $(patsubst %,%-32d24.png,$(PUZZLES))
16P32D8 = $(patsubst %,%-32d8.png,$(PUZZLES))
17P32D4 = $(patsubst %,%-32d4.png,$(PUZZLES))
18P16D24 = $(patsubst %,%-16d24.png,$(PUZZLES))
19P16D8 = $(patsubst %,%-16d8.png,$(PUZZLES))
20P16D4 = $(patsubst %,%-16d4.png,$(PUZZLES))
21ICONS = $(patsubst %,%.ico,$(PUZZLES))
22CICONS = $(patsubst %,%-icon.c,$(PUZZLES))
23RC = $(patsubst %,%.rc,$(PUZZLES))
24
25BIN = ../
26PIC = ./
27
28base: $(BASE)
29web: $(WEB)
30pngicons: $(P48D24) $(P32D24) $(P16D24)
31winicons: $(ICONS) $(RC)
32gtkicons: $(CICONS)
33all: base web pngicons winicons gtkicons
34
35# Build the base puzzle screenshots from which all the other images
36# are derived. Some of them involve showing a move animation
37# part-way through.
38fifteen-base.png : override REDO=0.3
39flip-base.png : override REDO=0.3
40netslide-base.png : override REDO=0.3
41sixteen-base.png : override REDO=0.3
42twiddle-base.png : override REDO=0.3
43$(BASE): %-base.png: $(BIN)% $(PIC)%.sav
44 $(PIC)screenshot.sh $(BIN)$* $(PIC)$*.sav $@ $(REDO)
45
46# Build the screenshots for the web, by scaling the original base
47# images to a uniform size.
48$(WEB): %-web.png: %-base.png
49 $(PIC)square.pl 150 5 $^ $@
50
51# Build the base _icon_ images, by careful cropping of the base
52# images: icons are very small so it's often necessary to zoom in
53# on a smaller portion of the screenshot.
54blackbox-ibase.png : override CROP=352x352 144x144+0+208
55bridges-ibase.png : override CROP=264x264 107x107+157+157
56dominosa-ibase.png : override CROP=304x272 152x152+152+0
57fifteen-ibase.png : override CROP=240x240 120x120+0+120
58filling-ibase.png : override CROP=256x256 133x133+14+78
59flip-ibase.png : override CROP=288x288 145x145+120+72
60galaxies-ibase.png : override CROP=288x288 165x165+0+0
61guess-ibase.png : override CROP=263x420 178x178+75+17
62inertia-ibase.png : override CROP=321x321 128x128+193+0
63lightup-ibase.png : override CROP=256x256 112x112+144+0
64loopy-ibase.png : override CROP=257x257 113x113+0+0
65mines-ibase.png : override CROP=240x240 110x110+130+130
66net-ibase.png : override CROP=193x193 113x113+0+80
67netslide-ibase.png : override CROP=289x289 144x144+0+0
68pattern-ibase.png : override CROP=384x384 223x223+0+0
69pegs-ibase.png : override CROP=263x263 147x147+116+0
70rect-ibase.png : override CROP=205x205 115x115+90+0
71sixteen-ibase.png : override CROP=288x288 144x144+144+144
72slant-ibase.png : override CROP=321x321 160x160+160+160
73solo-ibase.png : override CROP=321x321 97x97+16+16
74tents-ibase.png : override CROP=320x320 165x165+142+0
75twiddle-ibase.png : override CROP=192x192 102x102+69+21
76unequal-ibase.png : override CROP=208x208 104x104+104+104
77untangle-ibase.png : override CROP=320x320 164x164+3+116
78$(IBASE): %-ibase.png: %-base.png
79 $(PIC)crop.sh $^ $@ $(CROP)
80
81# Convert the full-size icon images to 4-bit colour, because that
82# seems to work better than reducing it in 24 bits and then
83# dithering.
84$(IBASE4): %-ibase4.png: %-ibase.png
85 convert -colors 16 +dither -map $(PIC)win16pal.xpm $^ $@
86
87# Build the 24-bit PNGs for the icons, at three sizes.
88$(P48D24): %-48d24.png: %-ibase.png
89 $(PIC)square.pl 48 4 $^ $@
90$(P32D24): %-32d24.png: %-ibase.png
91 $(PIC)square.pl 32 2 $^ $@
92$(P16D24): %-16d24.png: %-ibase.png
93 $(PIC)square.pl 16 1 $^ $@
94
95# The 8-bit icon PNGs are just custom-paletted quantisations of the
96# 24-bit ones.
97$(P48D8) $(P32D8) $(P16D8): %d8.png: %d24.png
98 convert -colors 256 $^ $@
99
100# But the depth-4 images work better if we re-shrink from the
101# ibase4 versions of the images, and then normalise the colours
102# again afterwards. (They're still not very good, but my hope is
103# that on most modern Windows machines this won't matter too
104# much...)
105$(P48D4): %-48d4.png: %-ibase4.png
106 $(PIC)square.pl 48 1 $^ $@-tmp2.png
107 convert -colors 16 -map $(PIC)win16pal.xpm $@-tmp2.png $@
108 rm -f $@-tmp2.png
109$(P32D4): %-32d4.png: %-ibase.png
110 $(PIC)square.pl 32 1 $^ $@-tmp2.png
111 convert -colors 16 -map $(PIC)win16pal.xpm $@-tmp2.png $@
112 rm -f $@-tmp2.png
113$(P16D4): %-16d4.png: %-ibase.png
114 $(PIC)square.pl 16 1 $^ $@-tmp2.png
115 convert -colors 16 -map $(PIC)win16pal.xpm $@-tmp2.png $@
116 rm -f $@-tmp2.png
117
118# Build the actual Windows icons themselves, by feeding all those
119# PNGs to my icon builder script.
120$(ICONS): %.ico: %-48d24.png %-48d8.png %-48d4.png \
121 %-32d24.png %-32d8.png %-32d4.png \
122 %-16d24.png %-16d8.png %-16d4.png
123 $(PIC)icon.pl -24 $*-48d24.png $*-32d24.png $*-16d24.png \
124 -8 $*-48d8.png $*-32d8.png $*-16d8.png \
125 -4 $*-48d4.png $*-32d4.png $*-16d4.png > $@
126
127# Build the .RC files which bind the icons into the applications.
128$(RC): %.rc:
129 echo '200 ICON "$*.ico"' > $@
130
131# Build the GTK icon source files.
132$(CICONS): %-icon.c: %-16d24.png %-32d24.png %-48d24.png
133 $(PIC)cicon.pl $^ > $@
134
135clean:
136 rm -f *.png *.ico *.rc *-icon.c