Grab screenshots via fbcat to fix colors

This commit is contained in:
Johannes Marbach 2024-04-18 20:21:11 +02:00
parent fc99725211
commit 9ef8414f17
79 changed files with 97 additions and 87 deletions

View file

@ -2,19 +2,13 @@
# Change this depending on what device you're generating the screenshots on
fb_res=1920x1080
fb_depth=8
fb_format=rgba
executable=$1
outdir=screenshots
config=buffyboard-screenshots.conf
themes=(
breezy-light
breezy-dark
pmos-light
pmos-dark
)
root=$(git rev-parse --show-toplevel)
themes_c=$root/shared/themes.c
resolutions=(
# Nokia N900
@ -34,6 +28,11 @@ resolutions=(
1920x1080
)
if ! which fbcat > /dev/null 2>&1; then
echo "Error: Could not find fbcat" 1>&2
exit 1
fi
if [[ ! -f $executable || ! -x $executable ]]; then
echo "Error: Could not find executable at $executable" 1>&2
exit 1
@ -50,14 +49,8 @@ touchscreen=false
EOF
}
# Hide cursor
echo -e '\033[?25l'
function clean_up() {
rm -f $config
# Show cursor
echo -e '\033[?25h'
}
trap clean_up EXIT
@ -67,7 +60,9 @@ mkdir "$outdir"
readme="# Buffyboard themes"$'\n'
for theme in ${themes[@]}; do
clear # Blank the screen
while read -r theme; do
write_config $theme
readme="$readme"$'\n'"## $theme"$'\n\n'
@ -78,23 +73,24 @@ for theme in ${themes[@]}; do
sleep 3 # Wait for UI to render
cat /dev/fb0 > "$outdir/$theme-$res"
convert -size $fb_res \
-depth $fb_depth \
fbcat /dev/fb0 > "$outdir/$theme-$res.ppm"
kill -15 $pid
convert \
-size $fb_res \
$outdir/$theme-$res.ppm \
screenshot-background.png \
$fb_format:"$outdir/$theme-$res" \
-crop $res+0+0 \
-gravity NorthWest \
-composite \
"$outdir/$theme-$res.png"
rm "$outdir/$theme-$res"
kill -15 $pid
rm "$outdir/$theme-$res.ppm"
readme="$readme<img src=\"$theme-$res.png\" alt=\"$res\" height=\"300\"/>"$'\n'
sleep 1 # Delay to prevent terminal mode set / reset interference
done
done
done < <(grep "name =" "$themes_c" | grep -o '".*"' | tr -d '"' | sort)
echo -n "$readme" > "$outdir/README.md"