Blame Scripts/Functions/Render/render_doSvgPostActions.sh

8af4d8
#!/bin/bash
8af4d8
#
ab1d67
# render_doSvgPostActions.sh -- This function performs
8af4d8
# post-rendition actions for SVG files.
8af4d8
#
8af4d8
# Copyright (C) 2009-2011 Alain Reguera Delgado
8af4d8
# 
8af4d8
# This program is free software; you can redistribute it and/or
8af4d8
# modify it under the terms of the GNU General Public License as
8af4d8
# published by the Free Software Foundation; either version 2 of the
8af4d8
# License, or (at your option) any later version.
8af4d8
# 
8af4d8
# This program is distributed in the hope that it will be useful, but
8af4d8
# WITHOUT ANY WARRANTY; without even the implied warranty of
8af4d8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
8af4d8
# General Public License for more details.
8af4d8
#
8af4d8
# You should have received a copy of the GNU General Public License
8af4d8
# along with this program; if not, write to the Free Software
8af4d8
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
8af4d8
# USA.
8af4d8
# 
8af4d8
# ----------------------------------------------------------------------
8af4d8
# $Id$
8af4d8
# ----------------------------------------------------------------------
8af4d8
ab1d67
function render_doSvgPostActions {
8af4d8
8af4d8
    local ACTION=''
941ac4
    
05d9ae
    # Define SVG-directory-specific post-rendition actions processing
05d9ae
    # as local to this function. Otherwise it may confuse command-line
05d9ae
    # post-rendition actions.
05d9ae
    local -a POSTACTIONS
05d9ae
941ac4
    # Write commentary to PNG images datastream to let everyone know
941ac4
    # where the image was created in.
42e42e
    if [[ $TEMPLATE =~ 'trunk/Identity/.+\.svg$' ]];then
941ac4
        POSTACTIONS[((++${#POSTACTIONS[*]}))]="renderComment" 
42e42e
    fi
42e42e
dc167f
    # Execute SVG directory-specific post-rendition actions to the
05d9ae
    # list of post actions and last actions. This is required in order
05d9ae
    # to provide a predictable way of producing content inside the
05d9ae
    # repository and save you the time of writing long option
05d9ae
    # combinations each time you need to produce images inside the
05d9ae
    # repository.
266fd5
    if [[ $TEMPLATE =~ "Backgrounds/.+\.svg$" ]];then
dc167f
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo: jpg'
ddd73c
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='groupSimilarFiles: png jpg'
05d9ae
    elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Syslinux/.+\.svg$" ]];then
5f7579
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderSyslinux'
5f7579
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderSyslinux:-floyd'
42e42e
    elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Grub/.+\.svg$" ]];then
5f7579
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderGrub'
5f7579
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderGrub:-floyd'
05d9ae
    elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Ksplash/.+\.svg$" ]];then
5f7579
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderKsplash'
05d9ae
    fi
dc167f
61bb5b
    # Verify svg-related post-rendition actions passed from
61bb5b
    # command-line and add them, if any, to post-rendition list of
61bb5b
    # actions.
61bb5b
    if [[ $FLAG_CONVERT != '' ]];then
61bb5b
        POSTACTIONS[((++${#POSTACTIONS[*]}))]="convertPngTo:${FLAG_CONVERT}"
61bb5b
    fi
61bb5b
    if [[ $FLAG_ROTATE != '' ]];then
61bb5b
        POSTACTIONS[((++${#POSTACTIONS[*]}))]="rotatePngTo:${FLAG_ROTATE}"
61bb5b
    fi
61bb5b
    if [[ $FLAG_RESIZE != '' ]];then
61bb5b
        POSTACTIONS[((++${#POSTACTIONS[*]}))]="resizePngTo:${FLAG_RESIZE}"
dc167f
    fi
dc167f
61bb5b
    # Execute post-rendition actions.
8af4d8
    for ACTION in "${POSTACTIONS[@]}"; do
8af4d8
8af4d8
        case "${ACTION}" in
8af4d8
dc167f
            convertPngTo:* )
ab1d67
                render_convertPngTo
dc167f
                ;;
dc167f
61bb5b
            rotatePngTo:* )
61bb5b
                render_rotatePngTo
61bb5b
                ;;
61bb5b
61bb5b
            resizePngTo:* )
61bb5b
                render_resizePngTo
61bb5b
                ;;
61bb5b
8af4d8
            renderSyslinux* )
ab1d67
                render_doSyslinux 
8af4d8
                ;;
8af4d8
8af4d8
            renderGrub* )
ab1d67
                render_doGrub 
8af4d8
                ;;
8af4d8
8af4d8
            renderBrands )
ab1d67
                render_doBrands 
8af4d8
                ;;
8af4d8
941ac4
            renderComment )
42e42e
                render_mogrifyCommentToPng
42e42e
                ;;
42e42e
266fd5
            groupSimilarFiles:* )
266fd5
                render_groupSimilarFiles
266fd5
                ;;
266fd5
8af4d8
        esac
8af4d8
8af4d8
    done
8af4d8
8af4d8
}