#!/bin/bash
#GScrot branding
#gscrot-plugin


TEXTDOMAIN=gscrot-plugins-bash
TEXTDOMAINDIR=$GSCROT_INTL
PLUGIN_NAME=$"GScrot branding"
PLUGIN_SORT=$"effect"
PLUGIN_TIP=$"polaroid whith GScrot logo and the name of the picture as subtitle"
PLUGIN_EXT="png"

if [[ "${1}" = "name" ]];then
   	echo "${PLUGIN_NAME}"
    exit 0
elif [[ "${1}" = "sort" ]];then
    echo "${PLUGIN_SORT}"
    exit 0
elif [[ "${1}" = "tip" ]];then
    echo "${PLUGIN_TIP}"
    exit 0
elif [[ "${1}" = "ext" ]];then
    echo "${PLUGIN_EXT}"
    exit 0
elif [[ "${1}" = "lang" ]];then
    echo "shell"
    exit 0
fi

FILE="${1}"
WIDTH="${2}"
HEIGHT="${3}"
FILEYTPE="${4}"
INTL_PATH="${5}"
GEO="${2}x${3}"
SHORTNAME=$(basename ${1} .png)
LOGO="$GSCROT_ROOT/share/gscrot/resources/system/plugins/bash/gspaddlogo/gscrot_branding.png"

mogrify -resize 480x400\> \
-bordercolor white -border 22x22 \
-gravity south -annotate 0 "${SHORTNAME}" \
-bordercolor white -border 4x4 \
"${FILE}"

convert "${FILE}" "${LOGO}" \
-background none -mosaic +repage "${FILE}"

mogrify  \
-bordercolor gray -border 1x1 \
-set comment "https://launchpad.net/gscrot" \
"${FILE}"

convert "${FILE}" \( +clone -background black  -shadow 80x3+5+5 \) \
+swap -background none -mosaic +repage -rotate -4 \
"${FILE}"

exit 0
