From db78301f8075daf66c4707383b383d031143bcf2 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 15 Mar 2024 14:56:50 +0000 Subject: [PATCH] Add line generation code --- griddle | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/griddle b/griddle index 900d8bd..d909e6e 100755 --- a/griddle +++ b/griddle @@ -13,6 +13,34 @@ get_image_dimension() { printf "%s" "$height" } +generate_lines() { + columns="$1" + rows="$2" + + width="$3" + height="$4" + + #colwidth=$((width / columns)) + #for i in $(seq 0 $columns); do + #current_colwidth=$((colwidth * i)) + #printf "line 0, %d %d, %d " $current_colwidth $height $current_colwidth + #done + + rowheight=$((height / rows)) + for i in $(seq 0 $rows); do + current_rowheight=$((rowheight * i)) + printf "line 0, %d %d, %d " $current_rowheight $width $current_rowheight + done +} + +create_image() { + inputfile="$1" + lines="$2" + outputfile="$3" + + convert -draw "$lines" "$inputfile" "$outputfile" +} + main() { if test "$#" -ne 4; then printf "Usage: griddle \n" @@ -43,7 +71,9 @@ main() { width="$(get_image_dimension $inputfile $WIDTH)" height="$(get_image_dimension $inputfile $HEIGHT)" - echo "$inputfile" "columns: $columns" "rows: $rows" "$outputfile" "Dimensions: $width x $height" + lines="$(generate_lines $columns $rows $width $height)" + + create_image "$inputfile" "$lines" "$outputfile" } main "$@"