modify build system to generate .png files from .svg files, with one

.svg as an example.
This commit is contained in:
Eric House 2013-10-18 22:36:45 -07:00
parent 07bfc3de37
commit d838151c0c
6 changed files with 83 additions and 1 deletions

View file

@ -6,3 +6,4 @@ gen
libs
proguard.cfg
obj
res/drawable*/*gen.png

View file

@ -54,6 +54,10 @@
<exec dir="." executable="../scripts/ndkbuild.sh" output="/dev/null">
<arg value="clean"/>
</exec>
<exec dir="." executable="../scripts/mkimages.sh" failonerror="true">
<arg value="--clean"/>
</exec>
</target>
<target name="-pre-build">
@ -65,6 +69,8 @@
<arg value="CHAT_ENABLED=${CHAT_ENABLED}" />
</exec>
<exec dir="." executable="../scripts/mkimages.sh" failonerror="true"/>
<exec dir="." executable="../scripts/gen_gcmid.sh"
output="src/org/eehouse/android/xw4/GCMConsts.java"
logError="true"

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120"
height="120" xml:space="preserve">
<g
id="g12"
transform="matrix(1.25,0,0,-1.25,0,120)">
<g id='g1388' transform='translate(66.77,29.35)'>
<path id='path1390' d='M 0,0 0,13.3 -4.16,13.3 -4.16,0 -17.26,0 -17.26,-4.162 -4.16,-4.162 -4.16,-17.46 0,-17.46 0,-4.162 13.11,-4.162 13.11,0 0,0 z' style='fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none'/>
</g><g id='g1392'>
<g id='g1394'>
<g id='g1400' transform='translate(33.31,41.18)'>
<path id='path1402' d='M 0,0 -2.713,2.713 16.38,21.81 19.09,19.09 0,0 z M -8.74,8.739 10.47,27.95 13.18,25.24 -6.027,6.024 -8.74,8.739 z M -10.61,-4.437 C -11.92,-4.437 -12.97,-3.381 -12.97,-2.08 -12.97,-0.778 -11.92,0.277 -10.61,0.277 -9.311,0.277 -8.256,-0.778 -8.256,-2.08 -8.256,-3.381 -9.311,-4.437 -10.61,-4.437 M 10.82,39.59 -17.15,11.85 -17.19,-8.752 3.41,-8.703 31.38,19.04 10.82,39.59 z' style='fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none'/>
</g>
<g id='g1404' transform='translate(32.95,84.1)'>
<path id='path1406' d='M 0,0 -12.49,-23.01 7.558,-3.594 0,0 z' style='fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none'/>
</g>
</g>
</g></g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -25,7 +25,8 @@
/>
<item android:id="@+id/gamel_menu_newgroup"
android:title="@string/button_new_group"
android:icon="@drawable/content_new"
android:icon="@drawable/new_group__gen"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/gamel_menu_prefs"
android:title="@string/menu_prefs"

View file

@ -0,0 +1,20 @@
# -*- mode: Makefile -*-
IMG_SRC = ./img_src
IMG_DEST = res
# $(IMG_DEST)/drawable/%_gen.png:
# pwd
# touch $@
# $(IMG_DEST)/drawable/%_gen.png: $(IMG_SRC)/%.svg
# convert -extent 48x48 $< $@
$(IMG_DEST)/drawable-xhdpi/%__gen.png: $(IMG_SRC)/%.svg
convert -negate -scale 64x64 $< $@
$(IMG_DEST)/drawable-mdpi/%__gen.png: $(IMG_SRC)/%.svg
convert -negate -scale 32x32 $< $@
$(IMG_DEST)/drawable-hdpi/%__gen.png: $(IMG_SRC)/%.svg
convert -negate -scale 48x48 $< $@

View file

@ -0,0 +1,34 @@
#!/bin/bash
set -e -u
if [ ! -e build.xml ]; then
echo "no build.xml; please run from root of source tree"
exit 1
fi
CLEAN=""
if [ $# -gt 1 ]; then
if [ $1 = '--clean' ]; then
CLEAN=1
fi
fi
# There needs to be target in the makefile for each of these (giving
# the output .png size)
TARGET_DIRS="drawable-hdpi drawable-mdpi drawable-xhdpi"
for SVG in img_src/*.svg; do
for DIR in $TARGET_DIRS; do
SVG=$(basename $SVG)
OUT=res/$DIR/${SVG/.svg/__gen.png}
if [ -z "$CLEAN" ]; then
make -f $(dirname $0)/images.mk $OUT
else
rm -f $OUT
fi
done
done