blob: cab7be8d3c25458493223cc5da316caadd4ae135 [file] [log] [blame]
Dan Pasanen24a1cc92016-12-28 22:59:21 -06001#!/bin/bash
2
3WIDTH="$1"
4HEIGHT="$2"
5HALF_RES="$3"
6OUT="$ANDROID_PRODUCT_OUT/obj/BOOTANIMATION"
7
8if [ "$HEIGHT" -lt "$WIDTH" ]; then
Asher Simondse035b9a2017-01-16 21:52:24 -06009 IMAGEWIDTH="$HEIGHT"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060010else
Asher Simondse035b9a2017-01-16 21:52:24 -060011 IMAGEWIDTH="$WIDTH"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060012fi
13
Asher Simondse035b9a2017-01-16 21:52:24 -060014IMAGESCALEWIDTH="$IMAGEWIDTH"
15IMAGESCALEHEIGHT=$(expr $IMAGESCALEWIDTH / 3)
16
Dan Pasanen24a1cc92016-12-28 22:59:21 -060017if [ "$HALF_RES" = "true" ]; then
Asher Simondse035b9a2017-01-16 21:52:24 -060018 IMAGEWIDTH=$(expr $IMAGEWIDTH / 2)
Dan Pasanen24a1cc92016-12-28 22:59:21 -060019fi
20
Asher Simondse035b9a2017-01-16 21:52:24 -060021IMAGEHEIGHT=$(expr $IMAGEWIDTH / 3)
22
23RESOLUTION=""$IMAGEWIDTH"x"$IMAGEHEIGHT""
Dan Pasanen24a1cc92016-12-28 22:59:21 -060024
Dan Pasanen46973d72017-01-19 14:01:59 -060025for part_cnt in 0 1 2 3 4
Dan Pasanen24a1cc92016-12-28 22:59:21 -060026do
27 mkdir -p $ANDROID_PRODUCT_OUT/obj/BOOTANIMATION/bootanimation/part$part_cnt
28done
Christopher N. Hesse70658802017-02-05 21:19:25 +010029tar xfp "vendor/cm/bootanimation/bootanimation.tar" -C "$OUT/bootanimation/"
30mogrify -resize $RESOLUTION -colors 250 "$OUT/bootanimation/"*"/"*".png"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060031
32# Create desc.txt
Asher Simonds070053c2017-01-16 21:52:24 -060033echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 60 > "$OUT/bootanimation/desc.txt"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060034cat "vendor/cm/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt"
35
36# Create bootanimation.zip
37cd "$OUT/bootanimation"
38
39zip -qr0 "$OUT/bootanimation.zip" .