From 01535a41c6cd27b14627cef5a00061f2fe22ed98 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 30 Apr 2017 02:33:57 +0200 Subject: [PATCH] Replace dss.dia by a shell script. The dia command line tool misaligns the text on the dss logo, and the dia application started to segfault on my home box after a library upgrade. This patch replaces the dia source file by the mklogo bash script which runs the convert utility of ImageMagick to write the dss logo in png format to stdout. The result looks almost identical. --- Makefile | 4 +- dss.dia | 960 ------------------------------------------------------- mklogo | 100 ++++++ 3 files changed, 102 insertions(+), 962 deletions(-) delete mode 100644 dss.dia create mode 100755 mklogo diff --git a/Makefile b/Makefile index 8adb38a..bf8092a 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,8 @@ cmdline.o: cmdline.c cmdline.h %.o: %.c Makefile $(CC) -c $(CFLAGS) $(DEBUG_CFLAGS) $< -%.png: %.dia - dia -e $@ -t png $< +dss.png: mklogo + ./mklogo > $@ cmdline.c cmdline.h: dss.ggo gengetopt --conf-parser < $< diff --git a/dss.dia b/dss.dia deleted file mode 100644 index a02f700..0000000 --- a/dss.dia +++ /dev/null @@ -1,960 +0,0 @@ - - - - - - - - - - - - - #A4# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #DSS# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mklogo b/mklogo new file mode 100755 index 0000000..54c8c95 --- /dev/null +++ b/mklogo @@ -0,0 +1,100 @@ +#!/bin/bash + +# Script for Image Magick that writes the dss logo in png format +# to stdout. + +set -u + +width=320 +height=110 +border=5 +radius1=4 +radius2=5 +circle_y=90 +arrow_y=70 +text_x=128 +text_y=55 +pointsize=36 + +declare -a circle arrow rectangle text + +make_circles() +{ + local inner='stroke black fill red circle' + local outer='stroke black fill black circle' + local num=1 + local idx=0 + local y=$circle_y + local step x0 i j idx num + + for ((i = 0; i < 4; i++)); do + step=$(((width / 4 + num) / (num + 1))) + x0=$((border + width / 4 * i)) + for ((j = 1; j <= $num; j++)); do + x=$((x0 + j * $step)) + circle[$idx]='-draw'; let idx++ + circle[$idx]="$outer $x,$y,$((x + radius2)),$y"; let idx++ + circle[$idx]='-draw'; let idx++ + circle[$idx]="$inner $x,$y,$((x + radius1)),$y"; let idx++ + done + num=$((num * 2)) + done + #echo "${circle[@]}"; exit 0 +} + +make_arrow() +{ + local arrow_head='l -15,-5 +5,+5 -5,+5 +15,-5 z' + local idx=0 + local x0 x1 y + + arrow[$idx]='-draw'; let idx++ + x0=$((3 * border)); x1=$((width - 2 * border)) + y=$arrow_y + arrow[$idx]="stroke white line $x0,$y $x1,$y"; let idx++ + arrow[$idx]='-draw'; let idx++ + x0=$((width - 2 * border)) + arrow[$idx]="stroke white fill white path 'M $x0,$y $arrow_head'" + #echo "${arrow[@]}"; exit 0 +} + +make_rectangles() +{ + local idx=0 + local x x0 x1 y y0 y1 i red_green color + + rectangle[$idx]='-draw'; let idx++ + x=$((width + 2 * border)) + y=$((height + 2 * border)) + rectangle[$idx]="stroke yellow fill yellow rectangle 0,0 $x,$y"; let idx++ + for ((i = 0; i < 4; i++)); do + rectangle[$idx]='-draw'; let idx++ + red_green="$(printf '%02x' $(((3 - i) * 60)))" + color="#${red_green}${red_green}ff" + x0=$((border + i * width / 4)); x1=$((x0 + width / 4 - 1)) + y0=$border; y1=$((y0 + height)) + rectangle[$idx]="stroke $color fill $color rectangle $x0,$y0 $x1,$y1" + let idx++ + done + #echo "${rectangle[@]}"; exit 0 +} + +make_text() +{ + text=(-pointsize $pointsize -draw \ + "fill white text $text_x,$text_y DSS") + #echo "${text[@]}"; exit 0 +} + +make_rectangles +make_arrow +make_circles +make_text + +convert -size $((width + 2 * border))x$((height + 2 * border)) \ + -background none xc: \ + "${rectangle[@]}" \ + "${arrow[@]}" \ + "${circle[@]}" \ + "${text[@]}" \ + png:- -- 2.39.5