diff --git a/Scripts/Bash/Functions/Render/Config/Identity/Themes/Distro/Anaconda/Prompt/render.conf.sh b/Scripts/Bash/Functions/Render/Config/Identity/Themes/Distro/Anaconda/Prompt/render.conf.sh index 95653fc..8192c00 100755 --- a/Scripts/Bash/Functions/Render/Config/Identity/Themes/Distro/Anaconda/Prompt/render.conf.sh +++ b/Scripts/Bash/Functions/Render/Config/Identity/Themes/Distro/Anaconda/Prompt/render.conf.sh @@ -28,7 +28,8 @@ function render_loadConfig { # Define rendering actions. ACTIONS[0]='BASE:renderImage' - ACTIONS[1]='POST:renderSyslinux' + ACTIONS[1]='POST:renderSyslinux:' + ACTIONS[2]='POST:renderSyslinux: -floyd' # Define matching list. MATCHINGLIST='' diff --git a/Scripts/Bash/Functions/Render/Config/Identity/Themes/Distro/BootUp/GRUB/render.conf.sh b/Scripts/Bash/Functions/Render/Config/Identity/Themes/Distro/BootUp/GRUB/render.conf.sh index 2aa96e8..84a658d 100755 --- a/Scripts/Bash/Functions/Render/Config/Identity/Themes/Distro/BootUp/GRUB/render.conf.sh +++ b/Scripts/Bash/Functions/Render/Config/Identity/Themes/Distro/BootUp/GRUB/render.conf.sh @@ -28,7 +28,8 @@ function render_loadConfig { # Define rendering actions. ACTIONS[0]='BASE:renderImage' - ACTIONS[1]='POST:renderGrub' + ACTIONS[1]='POST:renderGrub:' + ACTIONS[2]='POST:renderGrub: -floyd' # Define matching list. #MATCHINGLIST='' diff --git a/Scripts/Bash/Functions/Render/render_doIdentityImageGrub.sh b/Scripts/Bash/Functions/Render/render_doIdentityImageGrub.sh index c7f4f83..2f63af8 100644 --- a/Scripts/Bash/Functions/Render/render_doIdentityImageGrub.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityImageGrub.sh @@ -27,6 +27,37 @@ function render_doIdentityImageGrub { local FILE=$1 + local ACTION="$2" + local OPTIONS='' + + # Define 16 colors images default file name prefix. + local PREFIX='-14c' + + # Define options using those passed to actions from pre-rendering + # configuration script. These options are applied to pnmremap when + # doing color reduction, so any option available for pnmremap + # command can be passed to renderSyslinux functionality. + OPTIONS=$(echo "$ACTION" | cut -d: -f2-) + + # 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 files which + # do not. + if [[ "$OPTIONS" =~ '-floyd' ]];then + PREFIX="${PREFIX}-floyd" + fi + + # Check options passed to action. This is required in order to + # aviod using options used already in this script. For example + # -verbose and -mapfile options. + for OPTION in $OPTIONS;do + # Remove anything after equal sign inside option. + OPTION=$(echo $OPTION | cut -d'=' -f1) + if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then + cli_printMessage "`eval_gettext "The \\\$OPTION option is already used."`" + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + done # Define Motif's palette location. We do this relatively. local PALETTES=/home/centos/artwork/trunk/Identity/Themes/Motifs/$(cli_getThemeName)/Colors @@ -57,37 +88,19 @@ function render_doIdentityImageGrub { > $FILE.pnm # Reduce colors as specified in ppm palette of colors. - cli_printMessage "$FILE-14c.ppm" "AsSavedAsLine" - pnmremap -verbose -mapfile=$PALETTE_PPM \ + cli_printMessage "${FILE}${PREFIX}.ppm" "AsSavedAsLine" + pnmremap -verbose -mapfile=$PALETTE_PPM "$OPTIONS" \ < $FILE.pnm \ 2>>$FILE.log \ - > $FILE-14c.ppm + > ${FILE}${PREFIX}.ppm - # Create the splash-14c.xpm.gz file. - cli_printMessage "$FILE-14c.xpm.gz" "AsSavedAsLine" + # Create the 14 colors xpm.gz file. + cli_printMessage "${FILE}${PREFIX}.xpm.gz" "AsSavedAsLine" ppmtoxpm \ - < $FILE-14c.ppm \ + < ${FILE}${PREFIX}.ppm \ 2>>$FILE.log \ > $FILE.xpm \ && gzip --force $FILE.xpm \ - && mv $FILE.xpm.gz $FILE-14c.xpm.gz - - # Reduce colors as specified in ppm palette of colors using - # Floyd-Steinberg dithering. - cli_printMessage "$FILE-14c-floyd.ppm" "AsSavedAsLine" - pnmremap -verbose -floyd -mapfile=$PALETTE_PPM \ - < $FILE.pnm \ - 2>>$FILE.log \ - > $FILE-14c-floyd.ppm + && mv $FILE.xpm.gz ${FILE}${PREFIX}.xpm.gz - # Create the splash-14c-floyd.xpm.gz file. - cli_printMessage "$FILE-floyd.xpm.gz" "AsSavedAsLine" - ppmtoxpm \ - < $FILE-14c-floyd.ppm \ - 2>>$FILE.log \ - > $FILE.xpm \ - && gzip --force $FILE.xpm \ - && mv $FILE.xpm.gz $FILE-14c-floyd.xpm.gz - } - diff --git a/Scripts/Bash/Functions/Render/render_doIdentityImageSyslinux.sh b/Scripts/Bash/Functions/Render/render_doIdentityImageSyslinux.sh index f24d536..06ccd2e 100755 --- a/Scripts/Bash/Functions/Render/render_doIdentityImageSyslinux.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityImageSyslinux.sh @@ -27,10 +27,40 @@ function render_doIdentityImageSyslinux { local FILE=$1 + local ACTION="$2" + local OPTIONS='' + + # Define 16 colors images default file name prefix. + local PREFIX='-16c' + + # Define options using those passed to actions from pre-rendering + # configuration script. These options are applied to pnmremap when + # doing color reduction, so any option available for pnmremap + # command can be passed to renderSyslinux functionality. + OPTIONS=$(echo "$ACTION" | cut -d: -f2-) + + # 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 files which + # do not. + if [[ "$OPTIONS" =~ '-floyd' ]];then + PREFIX="${PREFIX}-floyd" + fi + + # Check options passed to action. This is required in order to + # aviod using options used already in this script. For example + # -verbose and -mapfile options. + for OPTION in $OPTIONS;do + # Remove anything after equal sign inside option. + OPTION=$(echo $OPTION | cut -d'=' -f1) + if [[ "$OPTION" =~ "-(mapfile|verbose)" ]];then + cli_printMessage "`eval_gettext "The \\\$OPTION option is already used."`" + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + done # Define Motif's palette location. We do this relatively. - local - PALETTES=/home/centos/artwork/trunk/Identity/Themes/Motifs/$(cli_getThemeName)/Colors + local PALETTES=/home/centos/artwork/trunk/Identity/Themes/Motifs/$(cli_getThemeName)/Colors # Define the Netpbm color palette used when reducing colors. This # palette should be 16 colors based. For more information on this @@ -65,11 +95,11 @@ function render_doIdentityImageSyslinux { # Reduce colors. Here we use the Netpbm color $PALETTE_PPM to # enforce the color position in the image index and the # Floyd-Steinberg dithering in order to improve color reduction. - cli_printMessage "$FILE-16c.pnm" "AsSavedAsLine" - pnmremap -verbose -floyd -mapfile=$PALETTE_PPM \ + cli_printMessage "$FILE${PREFIX}.pnm" "AsSavedAsLine" + pnmremap -verbose -mapfile=$PALETTE_PPM "$OPTIONS" \ < $FILE.pnm \ - 2>>$FILE.log > $FILE-16c.pnm - + 2>>$FILE.log > $FILE${PREFIX}.pnm + # Create LSS16 image. As specified in isolinux documentation the # background color should be indexed on position 0 and forground # in position 7 (see /usr/share/doc/syslinux-X.XX/isolinux.doc). @@ -80,26 +110,26 @@ function render_doIdentityImageSyslinux { # with the color information as described in isolinux # documentation (i.e #RRGGBB=0 #RRGGBB=1 ... [all values in the # same line]). - cli_printMessage "$FILE.lss" "AsSavedAsLine" + cli_printMessage "$FILE${PREFIX}.lss" "AsSavedAsLine" PALETTE_HEX=$(cat $PALETTE_HEX | tr "\n" ' ' | tr -s ' ') ppmtolss16 $PALETTE_HEX \ - < $FILE-16c.pnm \ + < $FILE${PREFIX}.pnm \ 2>>$FILE.log \ - > $FILE.lss + > $FILE${PREFIX}.lss # Create the PPM image indexed to 16 colors. Also the colormap # used in the LSS16 image is saved on $FILE.log; this is useful to # verify the correct order of colors in the image index. - cli_printMessage "$FILE-16c.ppm" "AsSavedAsLine" - lss16toppm -map < $FILE.lss \ + cli_printMessage "$FILE${PREFIX}.ppm" "AsSavedAsLine" + lss16toppm -map < $FILE${PREFIX}.lss \ 2>>$FILE.log \ - > $FILE.ppm + > $FILE${PREFIX}.ppm # Create the 16 colors PNG image. - cli_printMessage "$FILE-16c.png" "AsSavedAsLine" + cli_printMessage "$FILE${PREFIX}.png" "AsSavedAsLine" pnmtopng -verbose -palette=$PALETTE_PPM \ - < $FILE-16c.pnm \ + < $FILE${PREFIX}.pnm \ 2>>$FILE.log \ - > $FILE-16c.png + > $FILE${PREFIX}.png } diff --git a/Scripts/Bash/Functions/Render/render_doIdentityImages.sh b/Scripts/Bash/Functions/Render/render_doIdentityImages.sh index d0a4a75..1324f7c 100644 --- a/Scripts/Bash/Functions/Render/render_doIdentityImages.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityImages.sh @@ -100,12 +100,12 @@ function render_doIdentityImages { case "$ACTION" in - renderSyslinux ) - render_doIdentityImageSyslinux $FILE + renderSyslinux:* ) + render_doIdentityImageSyslinux $FILE "$ACTION" ;; - renderGrub ) - render_doIdentityImageGrub $FILE + renderGrub:* ) + render_doIdentityImageGrub $FILE "$ACTION" ;; renderFormats:* )