diff --git a/Scripts/Bash/Functions/Identity/identity_renderBrands.sh b/Scripts/Bash/Functions/Identity/identity_renderBrands.sh new file mode 100644 index 0000000..23950b4 --- /dev/null +++ b/Scripts/Bash/Functions/Identity/identity_renderBrands.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# identity_renderImageBrands.sh -- This function provides +# last-rendition actions to produce CentOS brands. This function takes +# both The CentOS Symbol and The CentOS Type images and produces +# variation of them in different dimensions and formats using +# ImageMagick tool-set. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderImageBrands { + + local SOURCEFILE='' + local TARGETDIR='' + local TARGETFILE='' + local NEWFILE='' + + # Define absolute path to image file. + local FILE="$1" + + # Define height dimensions you want to produce brands for. + local SIZES="16 20 22 24 32 36 40 48 64 96 128 148 164 196 200 512" + + # Define image formats you want to produce brands for. + local FORMATS="png xpm pdf jpg tif" + + # Redefine absolute path to directory where final brand images + # will be stored. Notice how both final image directory and design + # model have the same name, this is intentional in order to keep + # images and design models related and organized inside their own + # directory structures. + local DIRNAME=$(cli_getRepoName "$FILE" 'd')/$(cli_getRepoName "$FILE" 'fd') + + # Check directory where final brand images will be stored. + if [[ ! -d $DIRNAME ]];then + mkdir -p ${DIRNAME} + fi + + for SIZE in ${SIZES};do + + # Redefine name of new file. + NEWFILE=${DIRNAME}/${SIZE} + + for FORMAT in ${FORMATS};do + + # Output action information. + cli_printMessage "${NEWFILE}.${FORMAT}" "AsCreatingLine" + + # Convert and resize to create new file. + convert -resize x${SIZE} ${FILE}.png ${NEWFILE}.${FORMAT} + + done + + # Create logo copy in 2 colors. + cli_printMessage "${NEWFILE}.xbm (`gettext "2 colors grayscale"`)" "AsCreatingLine" + convert -resize x${SIZE} -colorspace gray -colors 2 ${FILE}.png ${NEWFILE}.xbm + + # Create logo copy in emboss effect. + cli_printMessage "${NEWFILE}-emboss.png" "AsCreatingLine" + convert -resize x${SIZE} -emboss 1 ${FILE}.png ${NEWFILE}-emboss.png + + done + + # Output division line. + cli_printMessage '-' 'AsSeparatorLine' +} diff --git a/Scripts/Bash/Functions/Identity/identity_renderDm.sh b/Scripts/Bash/Functions/Identity/identity_renderDm.sh new file mode 100755 index 0000000..17f3909 --- /dev/null +++ b/Scripts/Bash/Functions/Identity/identity_renderDm.sh @@ -0,0 +1,192 @@ +#!/bin/bash +# +# identity_renderImageDm.sh -- This function collects Display +# Manager (DM) required files and creates a tar.gz package that groups +# them all together. Use this function as last-rendition action for +# Gdm and Kdm base-rendition actions. +# +# Usage: +# +# ACTIONS[0]='BASE:renderImage' +# ACTIONS[1]='LAST:renderDm:TYPE:RESOLUTION' +# +# Where: +# +# TYPE can be either `Gdm' or `Kdm'. These values correspond to the +# directory names used to store related design models. +# +# RESOLUTION represents the screen resolution tar.gz files are +# produced for (e.g., 800x600, 1024x768, 2048x1536, etc.). +# +# In order to produce tar.gz files correctly, both screen resolution +# definition inside pre-rendition configuration script and background +# name inside theme directory structure need to match one another. If +# one screen resolution is defined correctly, but there is no +# background information for it, the related tar.gz file is not +# produced and the next file in the list of files to process is +# evaluated. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderImageDm { + + local -a SRC + local -a DST + local DM='' + local TGZ='' + local COUNT=0 + local RESOLUTION='' + local RESOLUTIONS='' + + # Get display manager passed from render.conf.sh pre-rendition + # configuration script. + DM=$(identity_getConfigOption "$1" '2') + + # Sanitate display manager passed from render.conf.sh + # pre-rendition configuration script. Whatever value be retrived + # as display manager configuration option is converted to + # uppercase in order to match either Gdm or Kdm design model + # directory structures. + DM=$(cli_getRepoName "$DM" 'd') + + # Get screen resolutions passed from render.conf.sh pre-rendition + # configuration script. + RESOLUTIONS=$(identity_getConfigOption "$1" '3') + + # Check screen resolutions passed from render.conf.sh + # pre-rendition configuration script. + if [[ "$RESOLUTIONS" == '' ]];then + cli_printMessage "`gettext "There is no resolution information to process."`" 'AsErrorLine' + cli_printMessage $(caller) "AsToKnowMoreLine" + fi + + # Define source files using absolute paths. + SRC[0]=$(cli_getRepoTLDir)/Identity/Brands/Img/Symbol/48.png + SRC[1]=${OUTPUT}/release.png + SRC[2]=${OUTPUT}/screenshot.png + SRC[3]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/GdmGreeterTheme.xml + SRC[4]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/GdmGreeterTheme.desktop + SRC[5]=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Backgrounds/Img/Png + SRC[6]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-language.png + SRC[7]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-reboot.png + SRC[8]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-session.png + SRC[9]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-shutdown.png + + # Define name used as temporal holder to build tar.gz file. + TGZ=$(cli_getPathComponent '--theme-name') + + # Define target files using relative paths. + DST[0]=${TGZ}/centos-symbol.png + DST[1]=${TGZ}/centos-release.png + DST[2]=${TGZ}/screenshot.png + DST[3]=${TGZ}/${TGZ}.xml + DST[4]=${TGZ}/GdmGreeterTheme.desktop + DST[5]=${TGZ}/background.png + DST[6]=${TGZ}/icon-language.png + DST[7]=${TGZ}/icon-reboot.png + DST[8]=${TGZ}/icon-session.png + DST[9]=${TGZ}/icon-shutdown.png + + # Move into the working directory. + pushd ${OUTPUT} > /dev/null + + # Create directory used as temporal holder to build tar.gz file. + if [[ ! -d ${TGZ} ]];then + mkdir ${TGZ} + fi + + for RESOLUTION in $RESOLUTIONS;do + + while [[ $COUNT -lt ${#SRC[*]} ]];do + + if [[ $COUNT -eq 5 ]];then + + # Redefine background information using resolution as + # reference. Avoid concatenation. + SRC[$COUNT]=$(echo "${SRC[$COUNT]}" | cut -d/ -f-13)/${RESOLUTION}-final.png + + # If background information defined inside + # pre-rendition configuration script doesn't match + # background information inside theme-specific + # backgrounds directory structure, try the next + # background definition. + if [[ ! -f ${SRC[$COUNT]} ]];then + continue 2 + fi + + elif [[ $COUNT =~ '^[6-9]$' ]];then + + # If display manager is Kdm, then increment counter and + # resume the next iteration. Icons aren't used on Kdm, + # so there's no need to have them inside it. + if [[ $DM =~ '^Kdm$' ]];then + COUNT=$(($COUNT + 1)) + continue + fi + + fi + + # Check existence of source files. + cli_checkFiles ${SRC[$COUNT]} + + # Copy files from source to target location. + cp ${SRC[$COUNT]} ${DST[$COUNT]} + + # Replace common translation markers from design model + # files with appropriate information. + if [[ $COUNT =~ '^(3|4)$' ]];then + cli_replaceTMarkers "${DST[$COUNT]}" + fi + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + + # Reset counter. + COUNT=0 + + # Print action message. + cli_printMessage "${OUTPUT}/${RESOLUTION}.tar.gz" "AsCreatingLine" + + # Create tar.gz file. + tar -czf "${RESOLUTION}.tar.gz" $TGZ + + done + + # Remove directory used as temporal holder to build targ.gz + # file. + rm -r $TGZ + + # Remove release-specific images. + cli_printMessage "${SRC[1]}" "AsDeletingLine" + rm ${SRC[1]} + cli_printMessage "${SRC[2]}" "AsDeletingLine" + rm ${SRC[2]} + + # Return to where we were initially. + popd > /dev/null + + # Output division rule. + cli_printMessage '-' 'AsSeparatorLine' + +} diff --git a/Scripts/Bash/Functions/Identity/identity_renderFormats.sh b/Scripts/Bash/Functions/Identity/identity_renderFormats.sh new file mode 100644 index 0000000..b42a261 --- /dev/null +++ b/Scripts/Bash/Functions/Identity/identity_renderFormats.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# +# identity_renderImageFormats.sh -- This function provides +# post-rendition action used to convert images from PNG to different +# image formats. This function uses ImageMagick command line image +# manipulation tool set to convert the base PNG image to as many +# formats as ImageMagick supports. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderImageFormats { + + # Get absolute path of PNG image file. + local FILE="$1" + + # Get image formats. + local FORMATS=$(identity_getConfigOption "$2" '2-') + + # Check base file existence. + if [[ -f ${FILE}.png ]];then + + # Check image formats. + if [[ "$FORMATS" != "" ]];then + + # Loop through image formats and do format convertion using + # PNG file as base. + for FORMAT in $FORMATS;do + cli_printMessage "${FILE}.${FORMAT}" "AsSavedAsLine" + convert -quality 85 ${FILE}.png ${FILE}.${FORMAT} + done + + fi + + fi + +} diff --git a/Scripts/Bash/Functions/Identity/identity_renderGrub.sh b/Scripts/Bash/Functions/Identity/identity_renderGrub.sh new file mode 100644 index 0000000..19e9b4f --- /dev/null +++ b/Scripts/Bash/Functions/Identity/identity_renderGrub.sh @@ -0,0 +1,105 @@ +#!/bin/bash +# +# identity_renderImageGrub.sh -- This function provides +# post-rendition action used to produce GRUB images. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderImageGrub { + + 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-rendition + # 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=$(identity_getConfigOption "$ACTION" '2-') + + # 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 -n $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. + local PALETTES=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Colors + + # Define the Netpbm color palettes used when reducing colors. + # These palettes should be 14 colors based. For more information + # on this see the GRUB's documentation. + local PALETTE_PPM=$PALETTES/grub.ppm + + # Print which palette of colors centos-art.sh script is using to + # produce grub content. This is relevant in order to know if we + # are using whether trunk or branches palette of colors. + cli_printMessage "$PALETTE_PPM" 'AsPaletteLine' + + # Check GRUB's palettes existence: If there is no palette assume + # that this is the first time you are rendition GRUB images. If + # that is the case the script will provide you with the PNG format + # which should be used as base to produce (using GIMP) the .gpl + # palette. The .gpl palette information is used to produced + # (using GIMP) the colormap (.ppm) which is used to automate the + # GRUB's 14 colors image (splash.png) rendition. If there is no + # palette available, do not apply color reduction, show a message, + # and continue. + cli_checkFiles $PALETTE_PPM + + # Create Netpbm superformat (PNM). PNM file is created from the + # PNG image rendered previously. PNM is a common point for image + # manipulation using Netpbm tools. + cli_printMessage "${FILE}.pnm" "AsSavedAsLine" + pngtopnm -verbose \ + < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm + + # Reduce colors as specified in ppm palette of colors. + cli_printMessage "${FILE}${PREFIX}.ppm" "AsSavedAsLine" + pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ + < ${FILE}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.ppm + + # Create the 14 colors xpm.gz file. + cli_printMessage "${FILE}${PREFIX}.xpm.gz" "AsSavedAsLine" + ppmtoxpm \ + < ${FILE}${PREFIX}.ppm 2>>${FILE}.log > ${FILE}.xpm \ + && gzip --force ${FILE}.xpm \ + && mv ${FILE}.xpm.gz ${FILE}${PREFIX}.xpm.gz + +} diff --git a/Scripts/Bash/Functions/Identity/identity_renderImageBrands.sh b/Scripts/Bash/Functions/Identity/identity_renderImageBrands.sh deleted file mode 100644 index 23950b4..0000000 --- a/Scripts/Bash/Functions/Identity/identity_renderImageBrands.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash -# -# identity_renderImageBrands.sh -- This function provides -# last-rendition actions to produce CentOS brands. This function takes -# both The CentOS Symbol and The CentOS Type images and produces -# variation of them in different dimensions and formats using -# ImageMagick tool-set. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderImageBrands { - - local SOURCEFILE='' - local TARGETDIR='' - local TARGETFILE='' - local NEWFILE='' - - # Define absolute path to image file. - local FILE="$1" - - # Define height dimensions you want to produce brands for. - local SIZES="16 20 22 24 32 36 40 48 64 96 128 148 164 196 200 512" - - # Define image formats you want to produce brands for. - local FORMATS="png xpm pdf jpg tif" - - # Redefine absolute path to directory where final brand images - # will be stored. Notice how both final image directory and design - # model have the same name, this is intentional in order to keep - # images and design models related and organized inside their own - # directory structures. - local DIRNAME=$(cli_getRepoName "$FILE" 'd')/$(cli_getRepoName "$FILE" 'fd') - - # Check directory where final brand images will be stored. - if [[ ! -d $DIRNAME ]];then - mkdir -p ${DIRNAME} - fi - - for SIZE in ${SIZES};do - - # Redefine name of new file. - NEWFILE=${DIRNAME}/${SIZE} - - for FORMAT in ${FORMATS};do - - # Output action information. - cli_printMessage "${NEWFILE}.${FORMAT}" "AsCreatingLine" - - # Convert and resize to create new file. - convert -resize x${SIZE} ${FILE}.png ${NEWFILE}.${FORMAT} - - done - - # Create logo copy in 2 colors. - cli_printMessage "${NEWFILE}.xbm (`gettext "2 colors grayscale"`)" "AsCreatingLine" - convert -resize x${SIZE} -colorspace gray -colors 2 ${FILE}.png ${NEWFILE}.xbm - - # Create logo copy in emboss effect. - cli_printMessage "${NEWFILE}-emboss.png" "AsCreatingLine" - convert -resize x${SIZE} -emboss 1 ${FILE}.png ${NEWFILE}-emboss.png - - done - - # Output division line. - cli_printMessage '-' 'AsSeparatorLine' -} diff --git a/Scripts/Bash/Functions/Identity/identity_renderImageDm.sh b/Scripts/Bash/Functions/Identity/identity_renderImageDm.sh deleted file mode 100755 index 17f3909..0000000 --- a/Scripts/Bash/Functions/Identity/identity_renderImageDm.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/bash -# -# identity_renderImageDm.sh -- This function collects Display -# Manager (DM) required files and creates a tar.gz package that groups -# them all together. Use this function as last-rendition action for -# Gdm and Kdm base-rendition actions. -# -# Usage: -# -# ACTIONS[0]='BASE:renderImage' -# ACTIONS[1]='LAST:renderDm:TYPE:RESOLUTION' -# -# Where: -# -# TYPE can be either `Gdm' or `Kdm'. These values correspond to the -# directory names used to store related design models. -# -# RESOLUTION represents the screen resolution tar.gz files are -# produced for (e.g., 800x600, 1024x768, 2048x1536, etc.). -# -# In order to produce tar.gz files correctly, both screen resolution -# definition inside pre-rendition configuration script and background -# name inside theme directory structure need to match one another. If -# one screen resolution is defined correctly, but there is no -# background information for it, the related tar.gz file is not -# produced and the next file in the list of files to process is -# evaluated. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderImageDm { - - local -a SRC - local -a DST - local DM='' - local TGZ='' - local COUNT=0 - local RESOLUTION='' - local RESOLUTIONS='' - - # Get display manager passed from render.conf.sh pre-rendition - # configuration script. - DM=$(identity_getConfigOption "$1" '2') - - # Sanitate display manager passed from render.conf.sh - # pre-rendition configuration script. Whatever value be retrived - # as display manager configuration option is converted to - # uppercase in order to match either Gdm or Kdm design model - # directory structures. - DM=$(cli_getRepoName "$DM" 'd') - - # Get screen resolutions passed from render.conf.sh pre-rendition - # configuration script. - RESOLUTIONS=$(identity_getConfigOption "$1" '3') - - # Check screen resolutions passed from render.conf.sh - # pre-rendition configuration script. - if [[ "$RESOLUTIONS" == '' ]];then - cli_printMessage "`gettext "There is no resolution information to process."`" 'AsErrorLine' - cli_printMessage $(caller) "AsToKnowMoreLine" - fi - - # Define source files using absolute paths. - SRC[0]=$(cli_getRepoTLDir)/Identity/Brands/Img/Symbol/48.png - SRC[1]=${OUTPUT}/release.png - SRC[2]=${OUTPUT}/screenshot.png - SRC[3]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/GdmGreeterTheme.xml - SRC[4]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/GdmGreeterTheme.desktop - SRC[5]=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Backgrounds/Img/Png - SRC[6]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-language.png - SRC[7]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-reboot.png - SRC[8]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-session.png - SRC[9]=$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/${DM}/icon-shutdown.png - - # Define name used as temporal holder to build tar.gz file. - TGZ=$(cli_getPathComponent '--theme-name') - - # Define target files using relative paths. - DST[0]=${TGZ}/centos-symbol.png - DST[1]=${TGZ}/centos-release.png - DST[2]=${TGZ}/screenshot.png - DST[3]=${TGZ}/${TGZ}.xml - DST[4]=${TGZ}/GdmGreeterTheme.desktop - DST[5]=${TGZ}/background.png - DST[6]=${TGZ}/icon-language.png - DST[7]=${TGZ}/icon-reboot.png - DST[8]=${TGZ}/icon-session.png - DST[9]=${TGZ}/icon-shutdown.png - - # Move into the working directory. - pushd ${OUTPUT} > /dev/null - - # Create directory used as temporal holder to build tar.gz file. - if [[ ! -d ${TGZ} ]];then - mkdir ${TGZ} - fi - - for RESOLUTION in $RESOLUTIONS;do - - while [[ $COUNT -lt ${#SRC[*]} ]];do - - if [[ $COUNT -eq 5 ]];then - - # Redefine background information using resolution as - # reference. Avoid concatenation. - SRC[$COUNT]=$(echo "${SRC[$COUNT]}" | cut -d/ -f-13)/${RESOLUTION}-final.png - - # If background information defined inside - # pre-rendition configuration script doesn't match - # background information inside theme-specific - # backgrounds directory structure, try the next - # background definition. - if [[ ! -f ${SRC[$COUNT]} ]];then - continue 2 - fi - - elif [[ $COUNT =~ '^[6-9]$' ]];then - - # If display manager is Kdm, then increment counter and - # resume the next iteration. Icons aren't used on Kdm, - # so there's no need to have them inside it. - if [[ $DM =~ '^Kdm$' ]];then - COUNT=$(($COUNT + 1)) - continue - fi - - fi - - # Check existence of source files. - cli_checkFiles ${SRC[$COUNT]} - - # Copy files from source to target location. - cp ${SRC[$COUNT]} ${DST[$COUNT]} - - # Replace common translation markers from design model - # files with appropriate information. - if [[ $COUNT =~ '^(3|4)$' ]];then - cli_replaceTMarkers "${DST[$COUNT]}" - fi - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - - # Reset counter. - COUNT=0 - - # Print action message. - cli_printMessage "${OUTPUT}/${RESOLUTION}.tar.gz" "AsCreatingLine" - - # Create tar.gz file. - tar -czf "${RESOLUTION}.tar.gz" $TGZ - - done - - # Remove directory used as temporal holder to build targ.gz - # file. - rm -r $TGZ - - # Remove release-specific images. - cli_printMessage "${SRC[1]}" "AsDeletingLine" - rm ${SRC[1]} - cli_printMessage "${SRC[2]}" "AsDeletingLine" - rm ${SRC[2]} - - # Return to where we were initially. - popd > /dev/null - - # Output division rule. - cli_printMessage '-' 'AsSeparatorLine' - -} diff --git a/Scripts/Bash/Functions/Identity/identity_renderImageFormats.sh b/Scripts/Bash/Functions/Identity/identity_renderImageFormats.sh deleted file mode 100644 index b42a261..0000000 --- a/Scripts/Bash/Functions/Identity/identity_renderImageFormats.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# -# identity_renderImageFormats.sh -- This function provides -# post-rendition action used to convert images from PNG to different -# image formats. This function uses ImageMagick command line image -# manipulation tool set to convert the base PNG image to as many -# formats as ImageMagick supports. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderImageFormats { - - # Get absolute path of PNG image file. - local FILE="$1" - - # Get image formats. - local FORMATS=$(identity_getConfigOption "$2" '2-') - - # Check base file existence. - if [[ -f ${FILE}.png ]];then - - # Check image formats. - if [[ "$FORMATS" != "" ]];then - - # Loop through image formats and do format convertion using - # PNG file as base. - for FORMAT in $FORMATS;do - cli_printMessage "${FILE}.${FORMAT}" "AsSavedAsLine" - convert -quality 85 ${FILE}.png ${FILE}.${FORMAT} - done - - fi - - fi - -} diff --git a/Scripts/Bash/Functions/Identity/identity_renderImageGrub.sh b/Scripts/Bash/Functions/Identity/identity_renderImageGrub.sh deleted file mode 100644 index 19e9b4f..0000000 --- a/Scripts/Bash/Functions/Identity/identity_renderImageGrub.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -# -# identity_renderImageGrub.sh -- This function provides -# post-rendition action used to produce GRUB images. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderImageGrub { - - 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-rendition - # 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=$(identity_getConfigOption "$ACTION" '2-') - - # 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 -n $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. - local PALETTES=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Colors - - # Define the Netpbm color palettes used when reducing colors. - # These palettes should be 14 colors based. For more information - # on this see the GRUB's documentation. - local PALETTE_PPM=$PALETTES/grub.ppm - - # Print which palette of colors centos-art.sh script is using to - # produce grub content. This is relevant in order to know if we - # are using whether trunk or branches palette of colors. - cli_printMessage "$PALETTE_PPM" 'AsPaletteLine' - - # Check GRUB's palettes existence: If there is no palette assume - # that this is the first time you are rendition GRUB images. If - # that is the case the script will provide you with the PNG format - # which should be used as base to produce (using GIMP) the .gpl - # palette. The .gpl palette information is used to produced - # (using GIMP) the colormap (.ppm) which is used to automate the - # GRUB's 14 colors image (splash.png) rendition. If there is no - # palette available, do not apply color reduction, show a message, - # and continue. - cli_checkFiles $PALETTE_PPM - - # Create Netpbm superformat (PNM). PNM file is created from the - # PNG image rendered previously. PNM is a common point for image - # manipulation using Netpbm tools. - cli_printMessage "${FILE}.pnm" "AsSavedAsLine" - pngtopnm -verbose \ - < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm - - # Reduce colors as specified in ppm palette of colors. - cli_printMessage "${FILE}${PREFIX}.ppm" "AsSavedAsLine" - pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ - < ${FILE}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.ppm - - # Create the 14 colors xpm.gz file. - cli_printMessage "${FILE}${PREFIX}.xpm.gz" "AsSavedAsLine" - ppmtoxpm \ - < ${FILE}${PREFIX}.ppm 2>>${FILE}.log > ${FILE}.xpm \ - && gzip --force ${FILE}.xpm \ - && mv ${FILE}.xpm.gz ${FILE}${PREFIX}.xpm.gz - -} diff --git a/Scripts/Bash/Functions/Identity/identity_renderImageKsplash.sh b/Scripts/Bash/Functions/Identity/identity_renderImageKsplash.sh deleted file mode 100755 index 02f21f3..0000000 --- a/Scripts/Bash/Functions/Identity/identity_renderImageKsplash.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# identity_renderImageKsplash.sh -- This function collects KDE -# splash (KSplash) required files and creates a tar.gz package that -# groups them all together. Use this function as last-rendition -# action for KSplash base-rendition action. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderImageKsplash { - - local -a SRC - local -a DST - local FONT='' - local COUNT=0 - - # Define font used to print bottom splash message. - FONT=$(cli_getRepoTLDir)/Identity/Fonts/DejaVuLGCSans-Bold.ttf - - # Check existence of font file. - cli_checkFiles "$FONT" 'f' - - # Define absolute source location of files. - SRC[0]="${OUTPUT}/splash_top.png" - SRC[1]="${OUTPUT}/splash_active_bar.png" - SRC[2]="${OUTPUT}/splash_inactive_bar.png" - SRC[3]="${OUTPUT}/splash_bottom.png" - SRC[4]="$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/Ksplash/Theme.rc" - - # Check absolute source location of files. - cli_checkFiles "${SRC[@]}" 'f' - - # Define relative target location of files. - DST[0]="${OUTPUT}/splash_top.png" - DST[1]="${OUTPUT}/splash_active_bar.png" - DST[2]="${OUTPUT}/splash_inactive_bar.png" - DST[3]="${OUTPUT}/splash_bottom.png" - DST[4]="${OUTPUT}/Theme.rc" - - # Print action message. - cli_printMessage "${OUTPUT}/Preview.png" 'AsCreatingLine' - - # Create `Preview.png' image. - convert -append ${SRC[0]} ${SRC[1]} ${SRC[3]} ${OUTPUT}/Preview.png - - # Add bottom text to Preview.png image. The text position was set - # inside an image of 400x300 pixels. If you change the final - # preview image dimension, you probably need to change the text - # position too. - mogrify -draw 'text 6,295 "KDE is up and running."' \ - -fill \#ffffff \ - -font $FONT \ - ${OUTPUT}/Preview.png - - # Copy `Theme.rc' file. - cp ${SRC[4]} ${DST[4]} - - # Apply common translation markers to Theme.rc file. - cli_replaceTMarkers "${DST[4]}" - - # Print separator line. - cli_printMessage '-' 'AsSeparatorLine' - -} diff --git a/Scripts/Bash/Functions/Identity/identity_renderImageSyslinux.sh b/Scripts/Bash/Functions/Identity/identity_renderImageSyslinux.sh deleted file mode 100755 index 536ff17..0000000 --- a/Scripts/Bash/Functions/Identity/identity_renderImageSyslinux.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash -# -# identity_renderImageSyslinux.sh -- This function provides -# post-rendition action used to produce syslinux images. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function identity_renderImageSyslinux { - - 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-rendition - # 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=$(identity_getConfigOption "$ACTION" '2-') - - # 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 - - # 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 motif's palette location. - local PALETTES=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Colors - - # Define the Netpbm color palette used when reducing colors. This - # palette should be 16 colors based. For more information on this - # see the isolinux documentation. - local PALETTE_PPM=$PALETTES/syslinux.ppm - - # Define hexadecimal color information used by ppmtolss16. Color - # information and order used on PALETTE_HEX and PALETTE_PPM should - # match exactly. - local PALETTE_HEX=$PALETTES/syslinux.hex - - # Print which palette of colors centos-art.sh script is using to - # produce grub content. This is relevant in order to know if we - # are using whether trunk or branches palette of colors. - cli_printMessage "$PALETTE_PPM" 'AsPaletteLine' - cli_printMessage "$PALETTE_HEX" 'AsPaletteLine' - - # Check syslinux's palettes existence: If there is no palette - # assume that this is the first time you are rendition syslinux - # images. If that is the case the script will provide you with the - # PNG format which should be used as base to produce (using GIMP) - # the .gpl palette. The .gpl palette information is used to - # produced (using GIMP) the colormap (.ppm) which is used to - # automate the syslinux's 16 colors image (syslinux-splash.png) - # rendition. If there is no palette available, do not apply color - # reduction, show a message, and continue. - cli_checkFiles $PALETTE_PPM - cli_checkFiles $PALETTE_HEX - - # Create Netpbm superformat (PNM). PNM file is created from the - # PNG image rendered previously. PNM is a common point for image - # manipulation using Netpbm tools. - cli_printMessage "${FILE}.pnm" "AsSavedAsLine" - pngtopnm -verbose \ - < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm - - # 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}${PREFIX}.pnm" "AsSavedAsLine" - pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ - < ${FILE}.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). - # This order of colors is specified in $PALETTE_PPM and redefined - # here again for the LSS16 image format. Both $PALETTE_PPM and - # LSS16 color map redefinition ($PALETTE_HEX) should have the same - # colors and index order. PALETTE_HEX should return just one line - # with the color information as described in isolinux - # documentation (i.e #RRGGBB=0 #RRGGBB=1 ... [all values in the - # same line]). - cli_printMessage "${FILE}${PREFIX}.lss" "AsSavedAsLine" - PALETTE_HEX=$(cat $PALETTE_HEX | tr "\n" ' ' | tr -s ' ') - ppmtolss16 $PALETTE_HEX \ - < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${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}${PREFIX}.ppm" "AsSavedAsLine" - lss16toppm -map \ - < ${FILE}${PREFIX}.lss 2>>${FILE}.log > ${FILE}${PREFIX}.ppm - - # Create the 16 colors PNG image. - cli_printMessage "${FILE}${PREFIX}.png" "AsSavedAsLine" - pnmtopng -verbose -palette=$PALETTE_PPM \ - < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.png - -} diff --git a/Scripts/Bash/Functions/Identity/identity_renderKsplash.sh b/Scripts/Bash/Functions/Identity/identity_renderKsplash.sh new file mode 100755 index 0000000..02f21f3 --- /dev/null +++ b/Scripts/Bash/Functions/Identity/identity_renderKsplash.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# +# identity_renderImageKsplash.sh -- This function collects KDE +# splash (KSplash) required files and creates a tar.gz package that +# groups them all together. Use this function as last-rendition +# action for KSplash base-rendition action. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderImageKsplash { + + local -a SRC + local -a DST + local FONT='' + local COUNT=0 + + # Define font used to print bottom splash message. + FONT=$(cli_getRepoTLDir)/Identity/Fonts/DejaVuLGCSans-Bold.ttf + + # Check existence of font file. + cli_checkFiles "$FONT" 'f' + + # Define absolute source location of files. + SRC[0]="${OUTPUT}/splash_top.png" + SRC[1]="${OUTPUT}/splash_active_bar.png" + SRC[2]="${OUTPUT}/splash_inactive_bar.png" + SRC[3]="${OUTPUT}/splash_bottom.png" + SRC[4]="$(cli_getRepoTLDir)/Identity/Themes/Models/${THEMEMODEL}/Distro/Ksplash/Theme.rc" + + # Check absolute source location of files. + cli_checkFiles "${SRC[@]}" 'f' + + # Define relative target location of files. + DST[0]="${OUTPUT}/splash_top.png" + DST[1]="${OUTPUT}/splash_active_bar.png" + DST[2]="${OUTPUT}/splash_inactive_bar.png" + DST[3]="${OUTPUT}/splash_bottom.png" + DST[4]="${OUTPUT}/Theme.rc" + + # Print action message. + cli_printMessage "${OUTPUT}/Preview.png" 'AsCreatingLine' + + # Create `Preview.png' image. + convert -append ${SRC[0]} ${SRC[1]} ${SRC[3]} ${OUTPUT}/Preview.png + + # Add bottom text to Preview.png image. The text position was set + # inside an image of 400x300 pixels. If you change the final + # preview image dimension, you probably need to change the text + # position too. + mogrify -draw 'text 6,295 "KDE is up and running."' \ + -fill \#ffffff \ + -font $FONT \ + ${OUTPUT}/Preview.png + + # Copy `Theme.rc' file. + cp ${SRC[4]} ${DST[4]} + + # Apply common translation markers to Theme.rc file. + cli_replaceTMarkers "${DST[4]}" + + # Print separator line. + cli_printMessage '-' 'AsSeparatorLine' + +} diff --git a/Scripts/Bash/Functions/Identity/identity_renderSyslinux.sh b/Scripts/Bash/Functions/Identity/identity_renderSyslinux.sh new file mode 100755 index 0000000..536ff17 --- /dev/null +++ b/Scripts/Bash/Functions/Identity/identity_renderSyslinux.sh @@ -0,0 +1,134 @@ +#!/bin/bash +# +# identity_renderImageSyslinux.sh -- This function provides +# post-rendition action used to produce syslinux images. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderImageSyslinux { + + 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-rendition + # 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=$(identity_getConfigOption "$ACTION" '2-') + + # 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 + + # 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 motif's palette location. + local PALETTES=$(cli_getRepoTLDir)/Identity/Themes/Motifs/$(cli_getPathComponent '--theme')/Colors + + # Define the Netpbm color palette used when reducing colors. This + # palette should be 16 colors based. For more information on this + # see the isolinux documentation. + local PALETTE_PPM=$PALETTES/syslinux.ppm + + # Define hexadecimal color information used by ppmtolss16. Color + # information and order used on PALETTE_HEX and PALETTE_PPM should + # match exactly. + local PALETTE_HEX=$PALETTES/syslinux.hex + + # Print which palette of colors centos-art.sh script is using to + # produce grub content. This is relevant in order to know if we + # are using whether trunk or branches palette of colors. + cli_printMessage "$PALETTE_PPM" 'AsPaletteLine' + cli_printMessage "$PALETTE_HEX" 'AsPaletteLine' + + # Check syslinux's palettes existence: If there is no palette + # assume that this is the first time you are rendition syslinux + # images. If that is the case the script will provide you with the + # PNG format which should be used as base to produce (using GIMP) + # the .gpl palette. The .gpl palette information is used to + # produced (using GIMP) the colormap (.ppm) which is used to + # automate the syslinux's 16 colors image (syslinux-splash.png) + # rendition. If there is no palette available, do not apply color + # reduction, show a message, and continue. + cli_checkFiles $PALETTE_PPM + cli_checkFiles $PALETTE_HEX + + # Create Netpbm superformat (PNM). PNM file is created from the + # PNG image rendered previously. PNM is a common point for image + # manipulation using Netpbm tools. + cli_printMessage "${FILE}.pnm" "AsSavedAsLine" + pngtopnm -verbose \ + < ${FILE}.png 2>${FILE}.log > ${FILE}.pnm + + # 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}${PREFIX}.pnm" "AsSavedAsLine" + pnmremap -verbose -mapfile=$PALETTE_PPM $OPTIONS \ + < ${FILE}.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). + # This order of colors is specified in $PALETTE_PPM and redefined + # here again for the LSS16 image format. Both $PALETTE_PPM and + # LSS16 color map redefinition ($PALETTE_HEX) should have the same + # colors and index order. PALETTE_HEX should return just one line + # with the color information as described in isolinux + # documentation (i.e #RRGGBB=0 #RRGGBB=1 ... [all values in the + # same line]). + cli_printMessage "${FILE}${PREFIX}.lss" "AsSavedAsLine" + PALETTE_HEX=$(cat $PALETTE_HEX | tr "\n" ' ' | tr -s ' ') + ppmtolss16 $PALETTE_HEX \ + < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${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}${PREFIX}.ppm" "AsSavedAsLine" + lss16toppm -map \ + < ${FILE}${PREFIX}.lss 2>>${FILE}.log > ${FILE}${PREFIX}.ppm + + # Create the 16 colors PNG image. + cli_printMessage "${FILE}${PREFIX}.png" "AsSavedAsLine" + pnmtopng -verbose -palette=$PALETTE_PPM \ + < ${FILE}${PREFIX}.pnm 2>>${FILE}.log > ${FILE}${PREFIX}.png + +}