#!/bin/sh
#
# This file is part of vdr-skinneutrino
# Copyright (C) 2007 Sascha Wessel <sawe@users.sf.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

SVGFILE=$1
XPMFILE=$2

SIZE=128x96

BACKGROUND=blue

COLORMAP='/* XPM */
static char *map[] = {
"16 1 15 1",
"0	c #000000", /* dark */
"1	c #000033",
"2	c #000066",
"3	c #000099",
"4	c #0000cc",
"5	c #0000ff", /* normal */
"6	c #3333ff",
"7	c #6666ff",
"8	c #9999ff",
"9	c #ccccff",
"a	c #ffffff", /* light */
"b	c #cccccc",
"c	c #999999",
"d	c #666666",
"e	c #333333",
"0123456789abcde"
};'

#mkdir -p logos

#for SVGFILE in logos-svg/*.svg; do
#	XPMFILE=logos/`basename "${SVGFILE}" .svg`.xpm
	echo "${SVGFILE} -> ${XPMFILE}"
	echo "$COLORMAP" | convert -resize ${SIZE} -background ${BACKGROUND} -map - "${SVGFILE}" ppm:- | pnmdepth 255 - | ppmtoxpm - > "${XPMFILE}"
#done

