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

4c79b5
#!/bin/bash
4c79b5
#
049673
# svg_convertPngToKsplash.sh -- This function collects KDE splash
049673
# (KSplash) required files and creates a tar.gz package that groups
049673
# them all together. Use this function as last-rendition action for
049673
# KSplash base-rendition action.
4c79b5
#
3b0984
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
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
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
049673
function svg_convertPngToKsplash {
4c79b5
39208d
    local -a SRC
39208d
    local -a DST
39208d
    local FONT=''
39208d
    local COUNT=0
4c79b5
39208d
    # Define font used to print bottom splash message.
25c2b4
    FONT=$(cli_getRepoTLDir)/Identity/Fonts/DejaVuLGCSans-Bold.ttf
4c79b5
39208d
    # Check existence of font file.
cb5967
    cli_checkFiles "$FONT"
4c79b5
39208d
    # Define absolute source location of files.
3ce7f9
    SRC[0]="${OUTPUT}/splash_top.png"
3ce7f9
    SRC[1]="${OUTPUT}/splash_active_bar.png"
3ce7f9
    SRC[2]="${OUTPUT}/splash_inactive_bar.png"
3ce7f9
    SRC[3]="${OUTPUT}/splash_bottom.png"
b6844a
    SRC[4]="$(dirname $TEMPLATE)/Theme.rc"
4c79b5
39208d
    # Check absolute source location of files.
cb5967
    cli_checkFiles "${SRC[@]}"
2c2082
39208d
    # Define relative target location of files.
3ce7f9
    DST[0]="${OUTPUT}/splash_top.png"
3ce7f9
    DST[1]="${OUTPUT}/splash_active_bar.png"
3ce7f9
    DST[2]="${OUTPUT}/splash_inactive_bar.png"
3ce7f9
    DST[3]="${OUTPUT}/splash_bottom.png"
3ce7f9
    DST[4]="${OUTPUT}/Theme.rc"
3ce7f9
3ce7f9
    # Print action message.
0ff158
    cli_printMessage "${OUTPUT}/Preview.png" --as-creating-line
2c2082
39208d
    # Create `Preview.png' image.
3ce7f9
    convert -append ${SRC[0]} ${SRC[1]} ${SRC[3]} ${OUTPUT}/Preview.png
2c2082
39208d
    # Add bottom text to Preview.png image. The text position was set
39208d
    # inside an image of 400x300 pixels. If you change the final
39208d
    # preview image dimension, you probably need to change the text
39208d
    # position too.
39208d
    mogrify -draw 'text 6,295 "KDE is up and running."' \
39208d
        -fill \#ffffff \
39208d
        -font $FONT \
3ce7f9
        ${OUTPUT}/Preview.png
2c2082
39208d
    # Copy `Theme.rc' file.
39208d
    cp ${SRC[4]} ${DST[4]}
4c79b5
39208d
    # Apply common translation markers to Theme.rc file.
79e54d
    cli_replaceTMarkers "${DST[4]}"
ec641d
4c79b5
}