support for a colored border in text

This commit is contained in:
Marcus 2024-01-05 02:15:06 +01:00
parent 5df59ebe22
commit 063ed86ee3
2 changed files with 14 additions and 5 deletions

View File

@ -35,7 +35,7 @@ convertimg: converts an image to a command list file in /tmp
FILENAME: path to any picture imagemagick can handle
fill: create a filled area with (env COLOR, W (width), H (height), X, Y)
text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR)
text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR, BORDERCOLOR)
MODE: static (env X and Y for position)
chaos (env X_MAX and Y_MAX for position range)
@ -46,7 +46,7 @@ MODE: static (env X and Y for position)
available env vars to configure:
IPFLOOT(string), FLOOTPORT(int), USECACHE(bool), FLOOTFORKS(int)
SIZE(int), TEXT(string), FONTSIZE(int), BGCOLOR(hex), COLOR(hex)
X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int)
BORDERCOLOR(hex), X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int)
RESIZE(int), ALPHACOLOR(hex), BOUNCESTEP(int)
```

View File

@ -353,6 +353,7 @@ floot() {
;;
""|text)
set -x
test -z "$TEXT" && TEXT="$0"
test -z "$FONTSIZE" && FONTSIZE=42
test -z "$COLOR" && COLOR="000000"
@ -363,9 +364,17 @@ floot() {
SIZE="-size $SIZE"
fi
if [ -n "$BORDERCOLOR" ]
then
BORDER="-bordercolor #${BORDERCOLOR} -border 2x2"
else
BORDER=""
fi
#convert -fill lightgreen -background white -pointsize 40 caption:"KARTTUR" -quality 72 DstImage.png
message "generating text, size $FONTSIZE for ${YELLOW}$FLOOTFORKS${ENDCOLOR} workers"
LOL_org="$(convert ${SIZE} +antialias -depth 8 -fill \#${COLOR} -background \#${BGCOLOR} -pointsize ${FONTSIZE} caption:"${TEXT}" -quality 72 txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//' -e 's/^/PX /')"
set +x
LOL_org="$(convert ${SIZE} ${BORDER} +antialias -depth 8 -fill \#${COLOR} -background \#${BGCOLOR} -pointsize ${FONTSIZE} caption:"${TEXT}" -quality 72 txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//' -e 's/^/PX /')"
loadLOL
;;
@ -488,7 +497,7 @@ case $1 in
echo ""
echo "FILENAME: path to any picture imagemagick can handle"
echo "fill: create a filled area with (env COLOR, W (width), H (height), X, Y)"
echo "text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR)"
echo "text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR, BORDERCOLOR)"
echo ""
echo "MODE: static (env X and Y for position)"
echo " chaos (env X_MAX and Y_MAX for position range)"
@ -499,7 +508,7 @@ case $1 in
echo "available env vars to configure:"
echo "IPFLOOT(string), FLOOTPORT(int), USECACHE(bool), FLOOTFORKS(int)"
echo "SIZE(int), TEXT(string), FONTSIZE(int), BGCOLOR(hex), COLOR(hex)"
echo "X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int)"
echo "BORDERCOLOR(hex), X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int)"
echo "RESIZE(int), ALPHACOLOR(hex), BOUNCESTEP(int)"
exit 1