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