Blame Scripts/Functions/Render/render_doSvg.sh

8af4d8
#!/bin/bash
8af4d8
#
ab1d67
# render_doSvg.sh -- This function performs base-rendition
8af4d8
# action 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_doSvg {
8af4d8
8af4d8
    # Define export id used inside design templates. This value
8af4d8
    # defines the design area we want to export.
8af4d8
    local EXPORTID='CENTOSARTWORK'
8af4d8
8af4d8
    # Check export id inside design templates.
8af4d8
    grep "id=\"$EXPORTID\"" $INSTANCE > /dev/null
8af4d8
    if [[ $? -gt 0 ]];then
0ff158
        cli_printMessage "`eval_gettext "There is not export id (\\\$EXPORTID) inside \\\"\\\$TEMPLATE\\\"."`" --as-error-line
8af4d8
    fi
8af4d8
8af4d8
    # Check existence of external files. Inside design templates and
8af4d8
    # their instances, external files are used to refere the
8af4d8
    # background information required by the design template. If such
8af4d8
    # background information is not available the image is produced
8af4d8
    # without background information. This is something that need to
8af4d8
    # be avoided.
ab1d67
    render_checkSvgAbsref "$INSTANCE"
8af4d8
0ff158
    # Render template instance using inkscape and save the output.
0ff158
    local INKSCAPE_OUTPUT="$(\
0ff158
        inkscape $INSTANCE --export-id=$EXPORTID --export-png=${FILE}.png)"
0ff158
0ff158
    # Modify output from inkscape to fit the centos-art.sh script
0ff158
    # output visual style.
0ff158
    cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Area' \
894511
        | sed -r "s!^Area!`gettext "Area"`: !")"
0ff158
    cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Background' \
874511
        | sed -r "s!^Background (RRGGBBAA):(.*)!`gettext "Background"`: \1 \2!")" 
0ff158
    cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Bitmap saved as' \
894511
        | sed -r "s!^Bitmap saved as:!`gettext "Saved as"`: !")"
8af4d8
 
8af4d8
}