Blame Automation/Modules/Render/Svg/svg_convertPngToKsplash.sh

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