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
#
2d3646
# Copyright (C) 2009, 2010, 2011 The CentOS Project
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# 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
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
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
fc1ac6
    # Define SVG post-rendition actions that modify base-rendition
fc1ac6
    # output in place.
fc1ac6
    [[ $FLAG_COMMENT != '' ]] && POSTACTIONS[((++${#POSTACTIONS[*]}))]="mogrifyPngToComment"
fc1ac6
    [[ $FLAG_SHARPEN != '' ]] && POSTACTIONS[((++${#POSTACTIONS[*]}))]="mogrifyPngToSharpen"
fc1ac6
fc1ac6
    # Define SVG directory-specific rendition. Directory-specfic
fc1ac6
    # rendition provides a predictable way of producing content inside
fc1ac6
    # the repository.
266fd5
    if [[ $TEMPLATE =~ "Backgrounds/.+\.svg$" ]];then
fc1ac6
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg'
fc1ac6
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='groupSimilarFiles:png jpg'
9f0c95
    elif [[ $TEMPLATE =~ "Concept/.+\.svg$" ]];then
fc1ac6
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngTo:jpg pdf'
fc1ac6
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='convertPngToThumbnail:250'
05d9ae
    elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Syslinux/.+\.svg$" ]];then
fc1ac6
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='doSyslinux'
fc1ac6
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='doSyslinux:-floyd'
42e42e
    elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Grub/.+\.svg$" ]];then
fc1ac6
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='doGrub'
fc1ac6
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='doGrub:-floyd'
05d9ae
    elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Ksplash/.+\.svg$" ]];then
5f7579
        POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderKsplash'
05d9ae
    fi
dc167f
fc1ac6
    # Define SVG post-rendition actions that create new files from
fc1ac6
    # base-rendition output.
fc1ac6
    [[ $FLAG_CONVERT != '' ]] && POSTACTIONS[((++${#POSTACTIONS[*]}))]="convertPngTo:$FLAG_CONVERT"
dc167f
fc1ac6
    # Execute SVG post-rendition actions.
8af4d8
    for ACTION in "${POSTACTIONS[@]}"; do
fc1ac6
        ${FUNCNAM}_$(echo "$ACTION" | cut -d: -f1)
8af4d8
    done
8af4d8
8af4d8
}