Blame Scripts/Functions/Render/Backends/Svg/svg_doLastActions.sh

8af4d8
#!/bin/bash
8af4d8
#
d81c42
# svg_doLastActions.sh -- This function performs last-rendition
d81c42
# actions for SVG files.
8af4d8
#
3b0984
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
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
d81c42
function svg_doLastActions {
8af4d8
8af4d8
    # Verify position of file being produced in the list of files been
8af4d8
    # currently processed.
05d9ae
    if [[ $THIS_FILE_DIR == $NEXT_FILE_DIR ]];then
05d9ae
        return
05d9ae
    fi
8af4d8
9b8686
    local ACTION=''
9b8686
2a0ac3
    # Redefine SVG last-rendition actions as local to avoid undesired
2a0ac3
    # concatenation when massive rendition is performed.
05d9ae
    local -a LASTACTIONS
8af4d8
2a0ac3
    # Define SVG directory-specific actions. This is required in order
2a0ac3
    # to provide a predictable way of producing content inside the
2a0ac3
    # repository and save you the time of writing long several
2a0ac3
    # commands each time you need to produce images inside the
05d9ae
    # repository.
2a0ac3
    if [[ $FLAG_DONT_DIRSPECIFIC == 'false' ]];then
2a0ac3
        if [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Gdm/.+\.svg$" ]];then
d81c42
            LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToDm:Gdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240'
2a0ac3
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Kdm/.+\.svg$" ]];then
d81c42
            LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToDm:Kdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240'
2a0ac3
        elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent --release-pattern)/Ksplash/.+\.svg$" ]];then
d81c42
            LASTACTIONS[((++${#LASTACTIONS[*]}))]='convertPngToKsplash:'
2a0ac3
        fi
05d9ae
    fi
8af4d8
2a0ac3
    # Define SVG last-rendition actions. Since last-rendition makes
2a0ac3
    # use of all files in the output directory structure and
2a0ac3
    # directory-specific rendition modifies all the files in the
2a0ac3
    # output directory structure as well, these actions must be
2a0ac3
    # defined after the directory-specific definition. Otherwise,
2a0ac3
    # modifications impossed by these actions may interfier the whole
2a0ac3
    # purpose of having a directory-specific rendition.
2a0ac3
    [[ $FLAG_LASTRENDITION != '' ]] && LASTACTIONS[((++${#LASTACTIONS[*]}))]="doLastActions:(png|jpg):${FLAG_LASTRENDITION}"
2a0ac3
05d9ae
    # At this point centos-art.sh should be producing the last file
05d9ae
    # from the same unique directory structure, so, before producing
2a0ac3
    # images for the next directory structure lets execute the list of
05d9ae
    # last-rendition actions for the current directory structure. 
05d9ae
    for ACTION in "${LASTACTIONS[@]}"; do
d81c42
        ${RENDER_BACKEND}_$(echo "$ACTION" | cut -d: -f1)
05d9ae
    done
8af4d8
05d9ae
}