Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | WIDTH="$1" |
| 4 | HEIGHT="$2" |
| 5 | HALF_RES="$3" |
| 6 | OUT="$ANDROID_PRODUCT_OUT/obj/BOOTANIMATION" |
| 7 | |
| 8 | if [ "$HEIGHT" -lt "$WIDTH" ]; then |
Asher Simonds | e035b9a | 2017-01-16 21:52:24 -0600 | [diff] [blame^] | 9 | IMAGEWIDTH="$HEIGHT" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 10 | else |
Asher Simonds | e035b9a | 2017-01-16 21:52:24 -0600 | [diff] [blame^] | 11 | IMAGEWIDTH="$WIDTH" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 12 | fi |
| 13 | |
Asher Simonds | e035b9a | 2017-01-16 21:52:24 -0600 | [diff] [blame^] | 14 | IMAGESCALEWIDTH="$IMAGEWIDTH" |
| 15 | IMAGESCALEHEIGHT=$(expr $IMAGESCALEWIDTH / 3) |
| 16 | |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 17 | if [ "$HALF_RES" = "true" ]; then |
Asher Simonds | e035b9a | 2017-01-16 21:52:24 -0600 | [diff] [blame^] | 18 | IMAGEWIDTH=$(expr $IMAGEWIDTH / 2) |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 19 | fi |
| 20 | |
Asher Simonds | e035b9a | 2017-01-16 21:52:24 -0600 | [diff] [blame^] | 21 | IMAGEHEIGHT=$(expr $IMAGEWIDTH / 3) |
| 22 | |
| 23 | RESOLUTION=""$IMAGEWIDTH"x"$IMAGEHEIGHT"" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 24 | |
| 25 | for part_cnt in 0 1 2 |
| 26 | do |
| 27 | mkdir -p $ANDROID_PRODUCT_OUT/obj/BOOTANIMATION/bootanimation/part$part_cnt |
| 28 | done |
| 29 | tar xfp "vendor/cm/bootanimation/bootanimation.tar" --to-command="convert - -resize '$RESOLUTION' \"png8:$OUT/bootanimation/\$TAR_FILENAME\"" |
| 30 | |
| 31 | # Create desc.txt |
Asher Simonds | e035b9a | 2017-01-16 21:52:24 -0600 | [diff] [blame^] | 32 | echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 30 > "$OUT/bootanimation/desc.txt" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 33 | cat "vendor/cm/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt" |
| 34 | |
| 35 | # Create bootanimation.zip |
| 36 | cd "$OUT/bootanimation" |
| 37 | |
| 38 | zip -qr0 "$OUT/bootanimation.zip" . |