|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
673f99 |
# svg_convertPngToSyslinux.sh -- This function provides post-rendition
|
|
|
8fc04a |
|
|
|
8fc04a |
#
|
|
|
673f99 |
|
|
|
673f99 |
|
|
|
673f99 |
# colors contains 16 colors only and is saved in a file named
|
|
|
673f99 |
# `syslinux.gpl. The `syslinux.gpl' file is used to build two other
|
|
|
673f99 |
|
|
|
673f99 |
|
|
|
673f99 |
# full color PNG image, produced as result of SVG base-rendition, to
|
|
|
673f99 |
|
|
|
673f99 |
|
|
|
673f99 |
|
|
|
8fc04a |
#
|
|
|
673f99 |
# In order to produce images in LSS16 format correctly, it is required
|
|
|
673f99 |
# that both the `syslinux.ppm' and `syslinux.hex' files do contain the
|
|
|
8fc04a |
# same color information. This is, both `syslinux.ppm' and
|
|
|
673f99 |
|
|
|
8fc04a |
# color index.
|
|
|
8fc04a |
#
|
|
|
8fc04a |
# In order for this function to work, the `syslinux.gpl' file should
|
|
|
8fc04a |
|
|
|
8fc04a |
#
|
|
|
2fe9b7 |
# GIMP Palette
|
|
|
2fe9b7 |
# Name: CentOS-TreeFlower-4-Syslinux
|
|
|
2fe9b7 |
# Columns: 16
|
|
|
2fe9b7 |
#
|
|
|
2fe9b7 |
# 32 76 141 204c8d
|
|
|
2fe9b7 |
# 37 82 146 255292
|
|
|
2fe9b7 |
# 52 94 153 345e99
|
|
|
2fe9b7 |
# 73 110 162 496ea2
|
|
|
2fe9b7 |
# 91 124 172 5b7cac
|
|
|
2fe9b7 |
# 108 136 180 6c88b4
|
|
|
2fe9b7 |
# 120 146 186 7892ba
|
|
|
2fe9b7 |
# 131 158 193 839ec1
|
|
|
2fe9b7 |
# 255 255 255 ffffff
|
|
|
2fe9b7 |
# 146 170 200 92aac8
|
|
|
2fe9b7 |
# 162 182 209 a2b6d1
|
|
|
2fe9b7 |
# 183 199 219 b7c7db
|
|
|
2fe9b7 |
# 204 216 230 ccd8e6
|
|
|
2fe9b7 |
# 221 229 238 dde5ee
|
|
|
2fe9b7 |
# 235 241 245 ebf1f5
|
|
|
2fe9b7 |
# 246 251 254 f6fbfe
|
|
|
4c79b5 |
#
|
|
|
2fe9b7 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
|
|
|
dcd347 |
|
|
|
dcd347 |
|
|
|
fa95b1 |
#
|
|
|
74a058 |
|
|
|
74a058 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
673f99 |
function svg_convertPngToSyslinux {
|
|
|
4c79b5 |
|
|
|
8fc04a |
|
|
|
4b1274 |
local COLORS='16'
|
|
|
f16762 |
|
|
|
15b1d2 |
|
|
|
f16762 |
|
|
|
f16762 |
|
|
|
f16762 |
|
|
|
8c13b6 |
local OPTIONS=$(render_getConfigOption "$ACTION" '2-')
|
|
|
f16762 |
|
|
|
f16762 |
|
|
|
8fc04a |
|
|
|
f16762 |
|
|
|
f16762 |
for OPTION in $OPTIONS;do
|
|
|
f16762 |
|
|
|
f16762 |
OPTION=$(echo $OPTION | cut -d'=' -f1)
|
|
|
f16762 |
if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then
|
|
|
0ff158 |
cli_printMessage "`eval_gettext "The \\\"\\\$OPTION\\\" option is already used."`" --as-error-line
|
|
|
f16762 |
fi
|
|
|
f16762 |
done
|
|
|
4c79b5 |
|
|
|
8fc04a |
# Define default file name prefix for 16 colors images.
|
|
|
4b1274 |
local PREFIX="-${COLORS}c"
|
|
|
8fc04a |
|
|
|
379ebf |
# Re-define 16 colors images default file name prefix using
|
|
|
379ebf |
|
|
|
379ebf |
|
|
|
379ebf |
|
|
|
379ebf |
if [[ "$OPTIONS" =~ '-floyd' ]];then
|
|
|
379ebf |
PREFIX="${PREFIX}-floyd"
|
|
|
379ebf |
fi
|
|
|
379ebf |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
4b1274 |
local PALETTE_GPL=${MOTIF_DIR}/Palettes/syslinux.gpl
|
|
|
8fc04a |
|
|
|
4b1274 |
|
|
|
673f99 |
|
|
|
673f99 |
|
|
|
673f99 |
|
|
|
4b1274 |
if [[ ! -f $PALETTE_GPL ]];then
|
|
|
673f99 |
svn cp ${MODEL_BASEDIR}/${FLAG_THEME_MODEL}/Palettes/syslinux.gpl ${PALETTE_GPL}
|
|
|
54cb18 |
cli_expandTMarkers ${PALETTE_GPL}
|
|
|
4b1274 |
fi
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
local PALETTE_PPM=$(cli_getTemporalFile "syslinux.ppm")
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
# same line])
|
|
|
8fc04a |
local PALETTE_HEX=$(cli_getTemporalFile "syslinux.hex")
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
0ff158 |
cli_printMessage "${FILE}.pnm" --as-savedas-line
|
|
|
9b4d7d |
pngtopnm -verbose \
|
|
|
9b4d7d |
< ${FILE}.png 2>${FILE}.log > ${FILE}.pnm
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
0ff158 |
cli_printMessage "$PALETTE_GPL" --as-palette-line
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8c13b6 |
svg_convertGplToPpm "$PALETTE_GPL" "$PALETTE_PPM" "$COLORS"
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8c13b6 |
svg_convertGplToHex "$PALETTE_GPL" "$PALETTE_HEX" "$COLORS"
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
8fc04a |
|
|
|
4c79b5 |
|
|
|
0ff158 |
cli_printMessage "${FILE}${PREFIX}.pnm" --as-savedas-line
|
|
|
379ebf |
pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \
|
|
|
9b4d7d |
< ${FILE}.pnm 2>> ${FILE}.log > ${FILE}${PREFIX}.pnm
|
|
|
f16762 |
|
|
|
8fc04a |
|
|
|
0ff158 |
cli_printMessage "${FILE}${PREFIX}.lss" --as-savedas-line
|
|
|
8fc04a |
ppmtolss16 $(cat $PALETTE_HEX) \
|
|
|
9b4d7d |
< ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.lss
|
|
|
4c79b5 |
|
|
|
8fc04a |
|
|
|
8fc04a |
if [[ -f ${PALETTE_HEX} ]];then
|
|
|
8fc04a |
rm $PALETTE_HEX
|
|
|
8fc04a |
fi
|
|
|
8fc04a |
|
|
|
4c79b5 |
|
|
|
9b4d7d |
|
|
|
4c79b5 |
|
|
|
0ff158 |
cli_printMessage "${FILE}${PREFIX}.ppm" --as-savedas-line
|
|
|
9b4d7d |
lss16toppm -map \
|
|
|
9b4d7d |
< ${FILE}${PREFIX}.lss 2>>${FILE}.log > ${FILE}${PREFIX}.ppm
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
0ff158 |
cli_printMessage "${FILE}${PREFIX}.png" --as-savedas-line
|
|
|
4c79b5 |
pnmtopng -verbose -palette=$PALETTE_PPM \
|
|
|
9b4d7d |
< ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.png
|
|
|
4c79b5 |
|
|
|
8fc04a |
|
|
|
8fc04a |
if [[ -f ${PALETTE_PPM} ]];then
|
|
|
8fc04a |
rm $PALETTE_PPM
|
|
|
8fc04a |
fi
|
|
|
8fc04a |
|
|
|
4c79b5 |
}
|