| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function render_doSyslinux { |
| |
| |
| local COLOR_NUMBER='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="-${COLOR_NUMBER}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 theme-specific palettes directory. |
| local PALETTES=$(cli_getRepoTLDir)/Identity/Images/Themes/$(cli_getPathComponent '--theme')/Palettes |
| |
| # 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=${PALETTES}/syslinux.gpl |
| |
| # Verify GPL palette existence. |
| cli_checkFiles $PALETTE_GPL |
| |
| # 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_convertGplToPpm "$PALETTE_GPL" "$PALETTE_PPM" "$COLOR_NUMBER" |
| |
| |
| render_convertGplToHex "$PALETTE_GPL" "$PALETTE_HEX" "$COLOR_NUMBER" |
| |
| |
| |
| |
| 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 |
| |
| } |