From 61bb5b6b8dbdc13ae3666fc88210971be072adbd Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Mar 15 2011 02:26:27 +0000 Subject: Update `render' functionality: - Add support for `--rotate' and `--resize' options as centos-art post-rendition actions. - Remove the `-to' suffix from `--convert-to', `--rotate-to', and `--resize-to' options. --- diff --git a/Scripts/Bash/Cli/Functions/Render/render.sh b/Scripts/Bash/Cli/Functions/Render/render.sh index 1f81578..959b549 100644 --- a/Scripts/Bash/Cli/Functions/Render/render.sh +++ b/Scripts/Bash/Cli/Functions/Render/render.sh @@ -29,28 +29,40 @@ function render { local ACTIONNAM='' local ACTIONVAL='' - # Define release number flag. The relesase number flag - # (--releasever) specifies the release number identity images are - # rendered for. By default no release number is used. + # Initialize `--releasever' option. The release version option + # controls the release number used to produce release-specific + # content. By default no release number is used. local FLAG_RELEASEVER='' - # Define architecture flag. The architecture flag (--basearch) - # specifies the architecture type identity images are rendered - # for. By default no architecture type is used. + # Initialize `--basearch' option. The base architecture option + # controls the architecture type used to produce + # architecture-specific content. By default no architecture type + # is used. local FLAG_BASEARCH='' - # Define theme model flag. The theme model flag (--theme-model) - # specifies the theme model used when no one is specified. + # Initialize `--theme-model' option. The theme model option + # specifies the the theme model name used to produce theme + # artistic motifs. local FLAG_THEME_MODEL='Default' - # Define convert-to flag. The convert-to flag (--convert-to) - # specifies the post-rendition image convertion action to perform - # upon PNG images. By default there is no image convertion. - local FLAG_CONVERT_TO='' + # Initialize `--convert' option. The convert option controls + # whether convert or not content produced by centos-art + # base-rendition. By default there is no content convertion. + local FLAG_CONVERT='' - # Define grouped-by flag. The grouped-by flag (--grouped-by) - # specifies the post-rendition image grouping action to perform - # upon images produced. By default there is no grouping action. + # Initialize `--rotate' option. The rotate option controls whether + # rotate or not image content produced by centos-art + # base-rendition. By default there is no content rotation. + local FLAG_ROTATE='' + + # Initialize `--resize' option. The resize option controls whether + # resize or not content produced by centos-art base-rendition. By + # default there is no content resizing. + local FLAG_RESIZE='' + + # Initialize `--group-by' option. The grouped-by option specifies + # whether grouping or not content produced by centos-art + # base-rendition. By default there is no content grouping. local FLAG_GROUPED_BY='' # Interpret arguments and options passed through command-line. diff --git a/Scripts/Bash/Cli/Functions/Render/render_convertPngTo.sh b/Scripts/Bash/Cli/Functions/Render/render_convertPngTo.sh index 691fadb..bd5e398 100644 --- a/Scripts/Bash/Cli/Functions/Render/render_convertPngTo.sh +++ b/Scripts/Bash/Cli/Functions/Render/render_convertPngTo.sh @@ -1,10 +1,7 @@ #!/bin/bash # # render_convertPngTo.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. +# to convert images images produced by centos-art base-rendition. # # Copyright (C) 2009-2011 Alain Reguera Delgado # @@ -33,19 +30,14 @@ function render_convertPngTo { local FORMATS=$(render_getConfigOption "$ACTION" '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 + cli_checkFiles ${FILE}.png 'f' + + # Check image formats and do convertion. + if [[ "$FORMATS" != "" ]];then + for FORMAT in $FORMATS;do + cli_printMessage "${FILE}.${FORMAT}" "AsSavedAsLine" + convert -quality 85 ${FILE}.png ${FILE}.${FORMAT} + done fi diff --git a/Scripts/Bash/Cli/Functions/Render/render_doSvgPostActions.sh b/Scripts/Bash/Cli/Functions/Render/render_doSvgPostActions.sh index 72e72e4..aecc36c 100644 --- a/Scripts/Bash/Cli/Functions/Render/render_doSvgPostActions.sh +++ b/Scripts/Bash/Cli/Functions/Render/render_doSvgPostActions.sh @@ -52,13 +52,20 @@ function render_doSvgPostActions { POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderKsplash' fi - # Execute SVG command-line-specific post-rendition actions passed - # from command-line and add them, if any, to post-rendition list - # of actions. - if [[ $FLAG_CONVERT_TO != '' ]];then - POSTACTIONS[((++${#POSTACTIONS[*]}))]="convertPngTo:${FLAG_CONVERT_TO}" + # Verify svg-related post-rendition actions passed from + # command-line and add them, if any, to post-rendition list of + # actions. + if [[ $FLAG_CONVERT != '' ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]="convertPngTo:${FLAG_CONVERT}" + fi + if [[ $FLAG_ROTATE != '' ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]="rotatePngTo:${FLAG_ROTATE}" + fi + if [[ $FLAG_RESIZE != '' ]];then + POSTACTIONS[((++${#POSTACTIONS[*]}))]="resizePngTo:${FLAG_RESIZE}" fi + # Execute post-rendition actions. for ACTION in "${POSTACTIONS[@]}"; do case "${ACTION}" in @@ -67,6 +74,14 @@ function render_doSvgPostActions { render_convertPngTo ;; + rotatePngTo:* ) + render_rotatePngTo + ;; + + resizePngTo:* ) + render_resizePngTo + ;; + renderSyslinux* ) render_doSyslinux ;; diff --git a/Scripts/Bash/Cli/Functions/Render/render_getArguments.sh b/Scripts/Bash/Cli/Functions/Render/render_getArguments.sh index 8bcb62a..48c975d 100644 --- a/Scripts/Bash/Cli/Functions/Render/render_getArguments.sh +++ b/Scripts/Bash/Cli/Functions/Render/render_getArguments.sh @@ -30,7 +30,7 @@ function render_getArguments { local ARGSS="" # Define long options we want to support. - local ARGSL="filter:,quiet,answer:,dont-commit-changes,releasever:,basearch:,convert-to:,group-by:,theme-model:" + local ARGSL="filter:,quiet,answer:,dont-commit-changes,releasever:,basearch:,convert:,rotate:,resize:,group-by:,theme-model:" # Redefine ARGUMENTS variable using getopt output. cli_doParseArguments @@ -82,8 +82,18 @@ function render_getArguments { shift 2 ;; - --convert-to ) - FLAG_CONVERT_TO="$2" + --convert ) + FLAG_CONVERT="$2" + shift 2 + ;; + + --rotate ) + FLAG_ROTATE="$2" + shift 2 + ;; + + --resize ) + FLAG_RESIZE="$2" shift 2 ;;