From 6d0c5defad74ee46b1291e8284f098cfaaa5069c Mon Sep 17 00:00:00 2001 From: adrianna Date: Wed, 2 Mar 2016 20:14:23 +0200 Subject: [PATCH 1/1] replaced image generation bash script with makefile --- koperkapel/images/Makefile | 53 +++++++++++++++++++++++++++ sources/vector/generate_bitmaps.sh | 59 ------------------------------ 2 files changed, 53 insertions(+), 59 deletions(-) create mode 100644 koperkapel/images/Makefile delete mode 100755 sources/vector/generate_bitmaps.sh diff --git a/koperkapel/images/Makefile b/koperkapel/images/Makefile new file mode 100644 index 0000000..1d584a1 --- /dev/null +++ b/koperkapel/images/Makefile @@ -0,0 +1,53 @@ +VPATH=../../sources/vector + +SVGS=$(shell find $(VPATH) -name "*.svg") +PNGS=$(patsubst $(VPATH)/%.svg, %.png, $(SVGS)) +ROACH=$(filter roach, $(PNGS)) + +ROACH_32=$(subst roach, roach_32, $(ROACH)) +ROACH_21=$(subst roach, roach_21, $(ROACH)) + +all: $(PNGS) $(ROACH_32) $(ROACH_21) roach_quartet roach_nonet + +# Default rule + +%.png: %.svg + @mkdir -p `dirname $@` + @inkscape -z -e $@ -w 64 -h 64 $< + +# Smaller roaches + +roach_32/%.png: roach/%.svg + @mkdir -p `dirname $@` + @inkscape -z -e $@ -w 32 -h 32 $< + +roach_21/%.png: roach/%.svg + @mkdir -p `dirname $@` + @inkscape -z -e $@ -w 21 -h 21 $< + +# Roach quartet + +roach_quartet: $(ROACH_32) + @mkdir -p roach_quartet + @montage $(foreach i, 1 2 3 4, roach_32/roach_$(i).png) -geometry +0+0 -background none roach_quartet/roach_1.png + @montage $(foreach i, 2 3 4 1, roach_32/roach_$(i).png) -geometry +0+0 -background none roach_quartet/roach_2.png + @montage $(foreach i, 3 4 1 2, roach_32/roach_$(i).png) -geometry +0+0 -background none roach_quartet/roach_3.png + @montage $(foreach i, 4 1 2 3, roach_32/roach_$(i).png) -geometry +0+0 -background none roach_quartet/roach_4.png + @montage $(foreach i, 1 2 3 4, roach_32/eyes_$(i).png) -geometry +0+0 -background none roach_quartet/eyes_1.png + @montage $(foreach i, 2 3 4 1, roach_32/eyes_$(i).png) -geometry +0+0 -background none roach_quartet/eyes_2.png + @montage $(foreach i, 3 4 1 2, roach_32/eyes_$(i).png) -geometry +0+0 -background none roach_quartet/eyes_3.png + @montage $(foreach i, 4 1 2 3, roach_32/eyes_$(i).png) -geometry +0+0 -background none roach_quartet/eyes_4.png + +# Roach nonet + +roach_nonet: $(ROACH_21) + @mkdir -p roach_nonet + @montage $(foreach i, 1 2 3 4 1 2 3 4 1, roach_21/roach_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/roach_1.png + @montage $(foreach i, 2 3 4 1 2 3 4 1 2, roach_21/roach_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/roach_2.png + @montage $(foreach i, 3 4 1 2 3 4 1 2 3, roach_21/roach_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/roach_3.png + @montage $(foreach i, 4 1 2 3 4 1 2 3 4, roach_21/roach_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/roach_4.png + @montage $(foreach i, 1 2 3 4 1 2 3 4 1, roach_21/eyes_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/eyes_1.png + @montage $(foreach i, 2 3 4 1 2 3 4 1 2, roach_21/eyes_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/eyes_2.png + @montage $(foreach i, 3 4 1 2 3 4 1 2 3, roach_21/eyes_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/eyes_3.png + @montage $(foreach i, 4 1 2 3 4 1 2 3 4, roach_21/eyes_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/eyes_4.png + diff --git a/sources/vector/generate_bitmaps.sh b/sources/vector/generate_bitmaps.sh deleted file mode 100755 index 67079ce..0000000 --- a/sources/vector/generate_bitmaps.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -# Simple generation of 64x64 tiles - -imgdir=../../koperkapel/images - -for dir in roach -do - mkdir -p ${imgdir}/$dir - for x in $dir/* - do - inkscape -z -e ${imgdir}/${x%.*}.png -w 64 -h 64 $x - done -done - -# Smaller roaches - -for size in 32 21 -do - mkdir -p ${imgdir}/roach_${size} - - for x in roach/* - do - xbase=`basename $x` - inkscape -z -e ${imgdir}/roach_${size}/${xbase%.*}.png -w ${size} -h ${size} $x - done -done - -# Roach quartet - -mkdir -p ${imgdir}/roach_quartet - -function quartet_tile { - for tile in roach eyes - do - montage ${imgdir}/roach_32/${tile}_${1}.png ${imgdir}/roach_32/${tile}_${2}.png ${imgdir}/roach_32/${tile}_${3}.png ${imgdir}/roach_32/${tile}_${4}.png -geometry +0+0 -background none ${imgdir}/roach_quartet/${tile}_${1}.png - done -} - -quartet_tile 1 2 3 4 -quartet_tile 2 3 4 1 -quartet_tile 3 4 1 2 -quartet_tile 4 1 2 3 - -# Roach nonet - -mkdir -p ${imgdir}/roach_nonet - -function nonet_tile { - for tile in roach eyes - do - montage ${imgdir}/roach_21/${tile}_${1}.png ${imgdir}/roach_21/${tile}_${2}.png ${imgdir}/roach_21/${tile}_${3}.png ${imgdir}/roach_21/${tile}_${4}.png ${imgdir}/roach_21/${tile}_${1}.png ${imgdir}/roach_21/${tile}_${2}.png ${imgdir}/roach_21/${tile}_${3}.png ${imgdir}/roach_21/${tile}_${4}.png ${imgdir}/roach_21/${tile}_${1}.png -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 ${imgdir}/roach_nonet/${tile}_${1}.png - done -} - -nonet_tile 1 2 3 4 -nonet_tile 2 3 4 1 -nonet_tile 3 4 1 2 -nonet_tile 4 1 2 3 -- 2.34.1