Blame Scripts/Bash/Functions/Render/Svg/svg_convertPngToKsplash.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# svg_convertPngToKsplash.sh -- This function collects KDE splash
878a2b
# (KSplash) required files and creates a tar.gz package that groups
878a2b
# them all together. Use this function as last-rendition action for
878a2b
# KSplash base-rendition action.
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_convertPngToKsplash {
878a2b
878a2b
    local -a SRC
878a2b
    local -a DST
878a2b
    local FONT=''
878a2b
    local COUNT=0
878a2b
878a2b
    # Define font used to print bottom splash message.
d29d90
    FONT=$(svg_getTTFont "DejaVuLGCSans-Bold")
878a2b
878a2b
    # Check existence of font file.
78b0cb
    cli_checkFiles -e "$FONT"
878a2b
878a2b
    # Define absolute source location of files.
878a2b
    SRC[0]="${OUTPUT}/splash_top.png"
878a2b
    SRC[1]="${OUTPUT}/splash_active_bar.png"
878a2b
    SRC[2]="${OUTPUT}/splash_inactive_bar.png"
878a2b
    SRC[3]="${OUTPUT}/splash_bottom.png"
878a2b
    SRC[4]="$(dirname $TEMPLATE)/Theme.rc"
878a2b
878a2b
    # Check absolute source location of files.
78b0cb
    cli_checkFiles -e "${SRC[@]}"
878a2b
878a2b
    # Define relative target location of files.
878a2b
    DST[0]="${OUTPUT}/splash_top.png"
878a2b
    DST[1]="${OUTPUT}/splash_active_bar.png"
878a2b
    DST[2]="${OUTPUT}/splash_inactive_bar.png"
878a2b
    DST[3]="${OUTPUT}/splash_bottom.png"
878a2b
    DST[4]="${OUTPUT}/Theme.rc"
878a2b
878a2b
    # Print action message.
878a2b
    cli_printMessage "${OUTPUT}/Preview.png" --as-creating-line
878a2b
878a2b
    # Create `Preview.png' image.
878a2b
    convert -append ${SRC[0]} ${SRC[1]} ${SRC[3]} ${OUTPUT}/Preview.png
878a2b
878a2b
    # Add bottom text to Preview.png image. The text position was set
878a2b
    # inside an image of 400x300 pixels. If you change the final
878a2b
    # preview image dimension, you probably need to change the text
878a2b
    # position too.
878a2b
    mogrify -draw 'text 6,295 "KDE is up and running."' \
878a2b
        -fill \#ffffff \
878a2b
        -font $FONT \
878a2b
        ${OUTPUT}/Preview.png
878a2b
878a2b
    # Copy `Theme.rc' file.
878a2b
    cp ${SRC[4]} ${DST[4]}
878a2b
878a2b
    # Apply common translation markers to Theme.rc file.
878a2b
    cli_expandTMarkers "${DST[4]}"
878a2b
878a2b
}