# Automatically derive Active, Armed and Big state from base image
#!/bin/sh +xv
#set -o verbose
export IMAGE=$1
export ScrCOMPILER="$2"
export ScrTARGET=$3
export TmpDIR=$4
export VERBOSE=

export EICONH_GAIN=1.4

export ICON128_DROPSHADOW="-o 12 12 -b 12  -B 64 64 64 0  -S 0 0 0 96"
export ICON128ACTIVE_DROPSHADOW="-o 12 12 -b 12  -B 64 64 64 0  -S 0 0 0 96"
export ICON128ARM_DROPSHADOW="-o 3 3 -b 5     -B 64 64 64 0  -S 0 0 0 96"
export ICON128BIG_DROPSHADOW="-o 7 7 -b 12    -B 64 64 64 0  -S 0 0 0 96"

# The more we crop here, the bigger the icon image will be,
# because it is then scaled to a fixed size...
#

export ICON128_CROP="0 0 0 0"

export ICON128ACTIVE_CROP="-12 -12 -12 -12"

export ICON128ARM_CROP="3 0 3 0"

export ICON128BIG_CROP="0 0 0 0"


$iDS $ICON128_DROPSHADOW Icons/images/$IMAGE.sgi $TmpDIR/$1.sgi
$iCR $EITHREADS -c $ICON128_CROP $TmpDIR/$1.sgi $TmpDIR/$1.sgi
$iS -ma $EITHREADS -s $EICON_SIZEX $EICON_SIZEY $TmpDIR/$1.sgi $TmpDIR/$IMAGE.c;rm $TmpDIR/$1.sgi

echo $EICONH_GAIN

$iCN $EITHREADS -c $EICONH_GAIN Icons/images/$IMAGE.sgi $TmpDIR/$1.sgi
$iDS $ICON128ACTIVE_DROPSHADOW $TmpDIR/$1.sgi $TmpDIR/$1.sgi
$iCR $EITHREADS -c $ICON128ACTIVE_CROP $TmpDIR/$1.sgi $TmpDIR/$1.sgi
$iS -ma $EITHREADS -s $EICON_SIZEX $EICON_SIZEY $TmpDIR/$1.sgi $TmpDIR/$IMAGE-Active.c;rm $TmpDIR/$1.sgi

$iCN $EITHREADS -c $EICONH_GAIN Icons/images/$IMAGE.sgi $TmpDIR/$1.sgi
$iDS $ICON128ARM_DROPSHADOW $TmpDIR/$1.sgi $TmpDIR/$1.sgi
$iCR $EITHREADS -c $ICON128ARM_CROP $TmpDIR/$1.sgi $TmpDIR/$1.sgi
$iS -ma $EITHREADS -s $EICON_SIZEX $EICON_SIZEY $TmpDIR/$1.sgi $TmpDIR/$IMAGE-Armed.c;rm $TmpDIR/$1.sgi

cat $TmpDIR/$IMAGE.c $TmpDIR/$IMAGE-Active.c $TmpDIR/$IMAGE-Armed.c > $TmpDIR/$1-all.c;rm -f $TmpDIR/$IMAGE.c $TmpDIR/$IMAGE-Active.c $TmpDIR/$IMAGE-Armed.c
$ScrCOMPILER -c $TmpDIR/$1-all.c -o $ScrTARGET;rm -f $TmpDIR/$1-all.c
