rockbox/utils/nwztools/plattools/data/make_images.sh
Amaury Pouly 0c1a96101c nwztools: rework dualboot
The new code gets closer to an actual bootloader:
- it provides a menu with three options: Sony, Rockox, tools with icons (and
  extracts the Sony logo from the NVP)
- the dualboot install script now creates a symlink from /.rockbox to
  /contents/.rockox which is necessary to run rockbox
- more text drawing / framebuffer functions
In the long run, we will move this under bootloader/ and rbutil/ and also use
firmware/ drawing facilities, at the moment we use OF display program which
is slow and creates some flickering.
The logo extraction/placement code was tested with resolution 240x320 and I
guessed some reasonable values for 240x400, but those will probably need some
tweaking.

Change-Id: I0319be902d21a7d33c1dee0fffdb4797065dbf8a
2016-11-12 22:16:48 +01:00

53 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
#
# This script contains the code used to produce all the images.
# Because of the variety of tools needed to achieve that, the result is also
# included in the repository but this makes it easier to modify the data
# to add more content
#
# path to root of repository
ROOT_DIR=../../../../
# final resolution
NWZ_WIDTH=130
NWZ_HEIGHT=130
# path to rockbox icon
RB_ICON_PATH=$ROOT_DIR/docs/logo/rockbox-icon.svg
# path to tools icon (currently stolen from KDE Oxygen icon set)
TOOL_ICON_PATH=Oxygen480-categories-preferences-system.svg
# convert_svg width height input output
function convert_svg
{
local width="$1"
local height="$2"
local input="$3"
local output="$4"
TMP=tmp.png
# convert from SVG to PNG
inkscape -z -e $TMP -w $width -h $height $input
if [ "$?" != 0 ]; then
echo "SVG -> PNG conversion failed"
exit 1
fi
# convert from PNG to BMP, force using "version 3" because the OF don't like
# "recent" BMP
convert -channel RGB $TMP -define bmp:format=bmp3 ${output}_icon.bmp
if [ "$?" != 0 ]; then
rm -f $TMP
echo "PNG -> BMP conversion failed"
exit 1
fi
# remove temporary
rm -f $TMP
}
# start by creating the bitmap files from rockbox-icon.svg for all resolutions
# we make a detour by svg because inkscape can only export to SVG
# NOTE: we use image magick to convert to bmp but the OF tools don't like BMPv5
# and contrary to what the documentation says, image magick tends to produce
# those by default unless asked otherwise
convert_svg $NWZ_WIDTH $NWZ_HEIGHT $RB_ICON_PATH rockbox
convert_svg $NWZ_WIDTH $NWZ_HEIGHT $TOOL_ICON_PATH tools