Blame Functions/Render/render_rotatePngTo.sh

67ae40
#!/bin/bash
67ae40
#
67ae40
# render_rotatePngTo.sh -- This function provides post-rendition
67ae40
# to convert images produced by centos-art base-rendition.
67ae40
#
67ae40
# Copyright (C) 2009-2011 Alain Reguera Delgado
67ae40
# 
67ae40
# This program is free software; you can redistribute it and/or
67ae40
# modify it under the terms of the GNU General Public License as
67ae40
# published by the Free Software Foundation; either version 2 of the
67ae40
# License, or (at your option) any later version.
67ae40
# 
67ae40
# This program is distributed in the hope that it will be useful, but
67ae40
# WITHOUT ANY WARRANTY; without even the implied warranty of
67ae40
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
67ae40
# General Public License for more details.
67ae40
#
67ae40
# You should have received a copy of the GNU General Public License
67ae40
# along with this program; if not, write to the Free Software
67ae40
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
67ae40
# USA.
67ae40
# 
67ae40
# ----------------------------------------------------------------------
67ae40
# $Id$
67ae40
# ----------------------------------------------------------------------
67ae40
67ae40
function render_rotatePngTo {
67ae40
67ae40
    local COUNT=1
67ae40
    local DEGREE=''
67ae40
    local DEGREES=$(render_getConfigOption "$ACTION" '2-')
67ae40
    local SRC=''
67ae40
    local DST=''
67ae40
67ae40
    # Check base file existence.
67ae40
    cli_checkFiles ${FILE}.png 'f'
67ae40
67ae40
    # Check image degrees.
67ae40
    if [[ "$DEGREES" != "" ]];then
67ae40
67ae40
        # Loop through image degrees and convert them using PNG file
67ae40
        # as base.
67ae40
        for DEGREE in $DEGREES;do
67ae40
            SRC=${FILE}.png
67ae40
            DST=${FILE}-rotated-$(echo $DEGREE | sed 's!%!!').png
67ae40
            cli_printMessage "$DST" "AsSavedAsLine"
67ae40
            convert -rotate $DEGREE ${SRC} ${DST}
67ae40
        done
67ae40
67ae40
    fi
67ae40
67ae40
}