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 | |
Dan Pasanen | 46973d7 | 2017-01-19 14:01:59 -0600 | [diff] [blame] | 25 | for part_cnt in 0 1 2 3 4 |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 26 | do |
| 27 | mkdir -p $ANDROID_PRODUCT_OUT/obj/BOOTANIMATION/bootanimation/part$part_cnt |
| 28 | done |
Christopher N. Hesse | 7065880 | 2017-02-05 21:19:25 +0100 | [diff] [blame] | 29 | tar xfp "vendor/cm/bootanimation/bootanimation.tar" -C "$OUT/bootanimation/" |
| 30 | mogrify -resize $RESOLUTION -colors 250 "$OUT/bootanimation/"*"/"*".png" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 31 | |
| 32 | # Create desc.txt |
Asher Simonds | 070053c | 2017-01-16 21:52:24 -0600 | [diff] [blame] | 33 | echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 60 > "$OUT/bootanimation/desc.txt" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 34 | cat "vendor/cm/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt" |
| 35 | |
| 36 | # Create bootanimation.zip |
| 37 | cd "$OUT/bootanimation" |
| 38 | |
| 39 | zip -qr0 "$OUT/bootanimation.zip" . |