#!/usr/bin/env bash
# ==========================================================================
#         ____            _                     _____           _
#        / ___| _   _ ___| |_ ___ _ __ ___     |_   _|__   ___ | |___
#        \___ \| | | / __| __/ _ \ '_ ` _ \ _____| |/ _ \ / _ \| / __|
#         ___) | |_| \__ \ ||  __/ | | | | |_____| | (_) | (_) | \__ \
#        |____/ \__, |___/\__\___|_| |_| |_|     |_|\___/ \___/|_|___/
#               |___/
#                             --- System-Tools ---
#                  https://www.nntb.no/~dreibh/system-tools/
# ==========================================================================
#
# GIMP Scripts
# Copyright (C) 2013-2026 by Thomas Dreibholz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Contact: thomas.dreibholz@gmail.com

# Bash options:
set -eux


INPUT1="examples/Bergen.jpeg"
INPUT2="examples/Background.png"

# ------ Use FractGen to generate the example image -------------------------
# Requires: clifractgen
if [ ! -e "${INPUT2}"  ] ; then
   if [ -e "/usr/share/fractgen/examples/alpha07.fsf" ] ; then
      clifractgen  /usr/share/fractgen/examples/alpha07.fsf "${INPUT2}" -W 1920 -H 1080 -M 2048
   elif [ -e "/usr/share/fractgen/examples/alpha07.fsf" ] ; then
      clifractgen  /usr/local/share/fractgen/examples/alpha07.fsf "${INPUT2}" -W 1920 -H 1080 -M 2048
   else
      echo >&2 "ERROR: Input FSF file not found!"
      exit 1
   fi
fi


# ------ Make-GlossyText ----------------------------------------------------
./Make-GlossyText NorNet1.png "NorNet Testbed" 128

./Make-GlossyText NorNet2.png "NorNet Testbed" 128 --bordersize 5 \
   --colorscheme "Brushed Aluminium" --font "Noto Sans Bold"

# Requires: fonts-lobster
./Make-GlossyText NorNet3.png "NorNet Testbed" 128 --bordersize 5 \
   --colorscheme "Golden" --font "Lobster Two Bold Italic" || true


# ------ Make-Caption -------------------------------------------------------
./Make-Caption Caption1.png "Caption Text $(LANG=C date)" 1024 42 "Noto Sans Bold" 60 \
   --foreground "#02266b" --background "#ffd700" --transparency 26


# ------ Make-<Conversion> Scripts ------------------------------------------
./Resize-with-Cropping "${INPUT1}" Image1.png 16:9 1920
./Resize-with-Cropping "${INPUT2}" Image2.png 16:9 1920


./Make-Mosaic Image1.png Mosaic1-H.png 24 4 4 --type hexagons --surface rough
./Make-Mosaic Image1.png Mosaic1-O.png 24 4 4 --type octagons --surface smooth --neatness 1.0

./Make-OldPhoto Image1.png OldPhoto1.png
./Make-OldPhoto Image1.png OldPhoto2.png --bordersize 20

./Make-Cloth Image1.png Cloth1.png
./Make-Cloth Image1.png Cloth2.png --depth 8

./Make-OilPainting Image1.png Painting1.png --masksize 8 --mode intensity
./Make-OilPainting Image1.png Painting2.png --masksize 8 --mode rgb

./Make-BumpMap Image2.png Background1.png
./Make-Mosaic Background1.png Background2.png 18 4 4 --type hexagons --surface smooth --neatness 0.5
