| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function render_svg_convertPngToSyslinux { |
| |
| |
| local COLORS='16' |
| |
| |
| |
| |
| |
| local OPTIONS=$(render_getConfigOption "$ACTION" '2-') |
| |
| |
| |
| |
| for OPTION in $OPTIONS;do |
| |
| OPTION=$(echo $OPTION | cut -d'=' -f1) |
| if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then |
| cli_printMessage "`eval_gettext "The \\\"\\\$OPTION\\\" option is already used."`" --as-error-line |
| fi |
| done |
| |
| # Define default file name prefix for 16 colors images. |
| local PREFIX="-${COLORS}c" |
| |
| # Re-define 16 colors images default file name prefix using |
| # options as reference. This is useful to differenciate final |
| # files produced using Floyd-Steinberg dithering and final files |
| # which are not. |
| if [[ "$OPTIONS" =~ '-floyd' ]];then |
| PREFIX="${PREFIX}-floyd" |
| fi |
| |
| # Define absolute path to GPL palette. The GPL palette defines the |
| # color information used to build syslinux images. This palette |
| # should be set to 16 colors and, as specified in isolinux |
| # documentation, the background color should be indexed on |
| # position 0 and the forground in position 7 (see |
| # /usr/share/doc/syslinux-X.XX/isolinux.doc, for more |
| # information.) |
| local PALETTE_GPL=${MOTIF_DIR}/Palettes/syslinux.gpl |
| |
| # Verify GPL palette existence. If it doesn't exist copy the one |
| # provided by the design model and expand translation markers in |
| # it. |
| if [[ ! -f $PALETTE_GPL ]];then |
| cp ${MODEL_BASEDIR}/${FLAG_THEME_MODEL}/Palettes/syslinux.gpl ${PALETTE_GPL} |
| cli_replaceTMarkers ${PALETTE_GPL} |
| fi |
| |
| # Define absolute path to PPM palette. The PPM palette is built |
| # from source palette (PALETTE_GPL) and provides the color |
| # information understood by `ppmremap', the program used to |
| # produce images in a specific amount of colors. |
| local PALETTE_PPM=$(cli_getTemporalFile "syslinux.ppm") |
| |
| # Define the HEX palette. The HEX palette is built from source |
| # palette (PALETTE_GPL) and provides the color information in the |
| # format understood by `ppmtolss16', the program used to produce |
| |
| |
| |
| |
| local PALETTE_HEX=$(cli_getTemporalFile "syslinux.hex") |
| |
| |
| |
| |
| |
| cli_printMessage "${FILE}.pnm" --as-savedas-line |
| pngtopnm -verbose \ |
| < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm |
| |
| |
| cli_printMessage "$PALETTE_GPL" --as-palette-line |
| |
| |
| render_svg_convertGplToPpm "$PALETTE_GPL" "$PALETTE_PPM" "$COLORS" |
| |
| |
| render_svg_convertGplToHex "$PALETTE_GPL" "$PALETTE_HEX" "$COLORS" |
| |
| |
| |
| |
| cli_printMessage "${FILE}${PREFIX}.pnm" --as-savedas-line |
| pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ |
| < ${FILE}.pnm 2>> ${FILE}.log > ${FILE}${PREFIX}.pnm |
| |
| |
| cli_printMessage "${FILE}${PREFIX}.lss" --as-savedas-line |
| ppmtolss16 $(cat $PALETTE_HEX) \ |
| < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.lss |
| |
| |
| if [[ -f ${PALETTE_HEX} ]];then |
| rm $PALETTE_HEX |
| fi |
| |
| |
| |
| |
| cli_printMessage "${FILE}${PREFIX}.ppm" --as-savedas-line |
| lss16toppm -map \ |
| < ${FILE}${PREFIX}.lss 2>>${FILE}.log > ${FILE}${PREFIX}.ppm |
| |
| |
| cli_printMessage "${FILE}${PREFIX}.png" --as-savedas-line |
| pnmtopng -verbose -palette=$PALETTE_PPM \ |
| < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.png |
| |
| |
| if [[ -f ${PALETTE_PPM} ]];then |
| rm $PALETTE_PPM |
| fi |
| |
| } |