blob: 41d8c022cb4bc950dbb738614d1b5f71e0ba6b48 [file] [log] [blame]
Dan Pasanen24a1cc92016-12-28 22:59:21 -06001#!/bin/bash
2
Vasyl Gellobc4bce82019-07-01 13:52:35 +00003PRODUCT_OUT="$1"
4WIDTH="$2"
5HEIGHT="$3"
6HALF_RES="$4"
7
8OUT="$PRODUCT_OUT/obj/BOOTANIMATION"
Dan Pasanen24a1cc92016-12-28 22:59:21 -06009
10if [ "$HEIGHT" -lt "$WIDTH" ]; then
Asher Simondse035b9a2017-01-16 21:52:24 -060011 IMAGEWIDTH="$HEIGHT"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060012else
Asher Simondse035b9a2017-01-16 21:52:24 -060013 IMAGEWIDTH="$WIDTH"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060014fi
15
Dan Pasanenb7822102017-04-03 08:30:16 -050016IMAGESCALEWIDTH="$IMAGEWIDTH"
17IMAGESCALEHEIGHT=$(expr $IMAGESCALEWIDTH / 3)
Asher Simondse035b9a2017-01-16 21:52:24 -060018
Dan Pasanenb7822102017-04-03 08:30:16 -050019if [ "$HALF_RES" = "true" ]; then
20 IMAGEWIDTH=$(expr $IMAGEWIDTH / 2)
21fi
22
23IMAGEHEIGHT=$(expr $IMAGEWIDTH / 3)
24
25RESOLUTION=""$IMAGEWIDTH"x"$IMAGEHEIGHT""
26
27for part_cnt in 0 1 2 3 4
28do
Vasyl Gellobc4bce82019-07-01 13:52:35 +000029 mkdir -p "$OUT/bootanimation/part$part_cnt"
Dan Pasanenb7822102017-04-03 08:30:16 -050030done
Dan Pasanen91f76202017-07-06 08:21:30 -050031tar xfp "vendor/lineage/bootanimation/bootanimation.tar" -C "$OUT/bootanimation/"
Dan Pasanenb7822102017-04-03 08:30:16 -050032mogrify -resize $RESOLUTION -colors 250 "$OUT/bootanimation/"*"/"*".png"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060033
34# Create desc.txt
Dan Pasanenb7822102017-04-03 08:30:16 -050035echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 60 > "$OUT/bootanimation/desc.txt"
Dan Pasanen91f76202017-07-06 08:21:30 -050036cat "vendor/lineage/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt"
Dan Pasanen24a1cc92016-12-28 22:59:21 -060037
38# Create bootanimation.zip
39cd "$OUT/bootanimation"
40
41zip -qr0 "$OUT/bootanimation.zip" .