Blame Scripts/Bash/Functions/Render/Svg/svg_convertGplToPpm.sh
|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# svg_convertGplToPpm.sh -- This function takes one palette produced
|
|
|
878a2b |
# by Gimp (e.g., syslinux.gpl) as input and outputs one PPM file based
|
|
|
878a2b |
# on it (e.g., syslinux.ppm).
|
|
|
878a2b |
#
|
|
|
878a2b |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function svg_convertGplToPpm {
|
|
|
878a2b |
|
|
|
878a2b |
local -a FILES
|
|
|
878a2b |
local COUNT=0
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local PALETTE_GPL="$1"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local PALETTE_PPM="$2"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local NUMBER="$3"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local COLOR=''
|
|
|
878a2b |
local COLORS=$(svg_getColors "$PALETTE_GPL" --head=$NUMBER --tail=$NUMBER --format='rrrggbb')
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
svg_checkColorAmount "$COLORS" "$NUMBER"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
svg_checkColorFormats $COLORS --format='rrggbb'
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
for COLOR in $COLORS;do
|
|
|
878a2b |
FILES[$COUNT]=$(cli_getTemporalFile ${COUNT}.ppm)
|
|
|
878a2b |
ppmmake $COLOR 1 1 > ${FILES[$COUNT]}
|
|
|
878a2b |
COUNT=$(($COUNT + 1))
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
pnmcat -lr ${FILES[*]} > $PALETTE_PPM
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
rm ${FILES[*]}
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
cli_checkFiles "$PALETTE_PPM"
|
|
|
878a2b |
|
|
|
878a2b |
}
|