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
Dan Pasanenb7822102017-04-03 08:30:16 -050014IMAGESCALEWIDTH="$IMAGEWIDTH"
15IMAGESCALEHEIGHT=$(expr $IMAGESCALEWIDTH / 3)
Asher Simondse035b9a2017-01-16 21:52:24 -060016
Dan Pasanenb7822102017-04-03 08:30:16 -050017if [ "$HALF_RES" = "true" ]; then
18 IMAGEWIDTH=$(expr $IMAGEWIDTH / 2)
19fi
20
21IMAGEHEIGHT=$(expr $IMAGEWIDTH / 3)
22
23RESOLUTION=""$IMAGEWIDTH"x"$IMAGEHEIGHT""
24
25for part_cnt in 0 1 2 3 4
26do
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/"
Dan Pasanenb7822102017-04-03 08:30:16 -050030mogrify -resize $RESOLUTION -colors 250 "$OUT/bootanimation/"*"/"*".png"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060031
32# Create desc.txt
Dan Pasanenb7822102017-04-03 08:30:16 -050033echo "$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" .