Blame Automation/centos-art.sh-mods/Render/Svg/svg.sh

Alain Reguera Delgado 8f60cb
#!/bin/bash
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# svg.sh -- This function performs base-rendition action for SVG
Alain Reguera Delgado 8f60cb
# files.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# Copyright (C) 2009-2013 The CentOS Project
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado 8f60cb
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado 8f60cb
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado 8f60cb
# your option) any later version.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado 8f60cb
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 8f60cb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 8f60cb
# General Public License for more details.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado 8f60cb
# along with this program; if not, write to the Free Software
Alain Reguera Delgado 8f60cb
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
# $Id$
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
function svg {
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Apply translation to design model in order to produce the
Alain Reguera Delgado 8f60cb
    # translated design model instance.
Alain Reguera Delgado 8f60cb
    svg_doTranslation
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Expand translation markers inside design model instance.
Alain Reguera Delgado 8f60cb
    cli_expandTMarkers ${INSTANCE}
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Initialize the export id used inside design templates. This
Alain Reguera Delgado 8f60cb
    # value defines the design area we want to export.
Alain Reguera Delgado 8f60cb
    local EXPORTID='CENTOSARTWORK'
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Verify the export id.
Alain Reguera Delgado 8f60cb
    svg_checkModelExportId "$INSTANCE" "$EXPORTID" 
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Check existence of external files. Inside design templates and
Alain Reguera Delgado 8f60cb
    # their instances, external files are used to refer the background
Alain Reguera Delgado 8f60cb
    # information required by the design template. If such background
Alain Reguera Delgado 8f60cb
    # information is not available the image is produced without
Alain Reguera Delgado 8f60cb
    # background information. This is something that need to be
Alain Reguera Delgado 8f60cb
    # avoided.
Alain Reguera Delgado 8f60cb
    svg_checkModelAbsref "$INSTANCE"
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Render template instance using inkscape and save the output.
Alain Reguera Delgado 8f60cb
    local INKSCAPE_OUTPUT="$(\
Alain Reguera Delgado 8f60cb
        inkscape $INSTANCE --export-id=$EXPORTID --export-png=${FILE}.png)"
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Modify output from inkscape to fit the centos-art.sh script
Alain Reguera Delgado 8f60cb
    # output visual style.
Alain Reguera Delgado 8f60cb
    cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Area' \
Alain Reguera Delgado 8f60cb
        | sed -r "s!^Area!`gettext "Area"`:!")" --as-inkscape-line
Alain Reguera Delgado 8f60cb
    cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Background' \
Alain Reguera Delgado 8f60cb
        | sed -r "s!^Background (RRGGBBAA):(.*)!`gettext "Background"`: \1 \2!")" --as-inkscape-line
Alain Reguera Delgado 8f60cb
    cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Bitmap saved as' \
Alain Reguera Delgado 8f60cb
        | sed -r "s!^Bitmap saved as:!`gettext "Saved as"`:!")" --as-inkscape-line
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Perform format post-rendition.
Alain Reguera Delgado 8f60cb
    svg_doPostActions
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Perform format last-rendition.
Alain Reguera Delgado 8f60cb
    svg_doLastActions
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
}