From 5461acf1fbd86d5e83862ceacd466a2d53b25382 Mon Sep 17 00:00:00 2001 From: Bert Timmerman Date: Mon, 10 Sep 2012 21:09:34 +0200 Subject: [PATCH 1/1] Added a blinking pcb graphics diff. Signed-off-by: Bert Timmerman --- tools/Makefile.am | 3 +- tools/pcb_blink | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletions(-) create mode 100755 tools/pcb_blink diff --git a/tools/Makefile.am b/tools/Makefile.am index 3900614..2aca4b0 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -19,7 +19,8 @@ TOOLS= \ MergePCBPS \ Merge_dimPCBPS \ PCB2HPGL \ - pcbdiff + pcbdiff \ + pcb_blink DIST_SCM= \ gnet-pcbfwd.scm diff --git a/tools/pcb_blink b/tools/pcb_blink new file mode 100755 index 0000000..b56eb7c --- /dev/null +++ b/tools/pcb_blink @@ -0,0 +1,74 @@ +#! /bin/sh + +usage () +{ + echo Usage: + echo \\tpcb_blink firstfile secondfile delay + echo \\tDelay is in centi-seconds, default is 50 + echo \\tView a blinking graphical diff of PCB files + + echo \\tRequirements: Imagemagick and gschem must be installed +} + +PCB=`which pcb` +if test -z "${PCB}"; then + MISSING=pcb +fi + +CONVERT=`which convert` +if test -z "${CONVERT}"; then + MISSING=convert +fi + +COMPOSITE=`which composite` +if test -z "${COMPOSITE}"; then + MISSING=composite +fi + +VIEWER=`which display` +if test -z "${VIEWER}"; then + MISSING=display +fi + +if test -z "${MISSING}"; then + true +else + echo "Binary for \"${MISSING}\" not found." >&2 + echo "Either it is not installed, or not in your PATH" >&2 + exit 1 +fi + +#In case the script was invoked with extra option arguments, throw them away +shift `expr $# - 3` + +LEFTFILE="${1}" +RIGHTFILE="${2}" + +if test -z "${3}"; then + DELAY=50 +else + DELAY="${3}" +fi + +if test -d "${LEFTFILE}" -o -d "${RIGHTFILE}" + then echo "ERROR: pcb_blink cannot diff entire directories" + exit 1 +fi + +LEFTGIF=`mktemp --tmpdir pcbdiff.XXXXXXXXXX` +RIGHTGIF=`mktemp --tmpdir pcbdiff.XXXXXXXXXX` +LEFTBNW=`mktemp --tmpdir pcbdiff.XXXXXXXXXX` +RIGHTBNW=`mktemp --tmpdir pcbdiff.XXXXXXXXXX` +DIFFGIF=`mktemp --tmpdir pcbdiff.XXXXXXXXXX` + +"${PCB}" -x png --dpi ${PCBDIFF_DPI:-200} --photo-mode --format GIF --outfile ${LEFTGIF} "${LEFTFILE}" +"${PCB}" -x png --dpi ${PCBDIFF_DPI:-200} --photo-mode --format GIF --outfile ${RIGHTGIF} "${RIGHTFILE}" +"${CONVERT}" -colorspace gray $LEFTGIF $LEFTBNW +"${CONVERT}" -colorspace gray $RIGHTGIF $RIGHTBNW +"${CONVERT}" -delay $DELAY $LEFTBNW $RIGHTBNW -loop 0 $DIFFGIF +"${VIEWER}" $DIFFGIF +rm $LEFTGIF +rm $RIGHTGIF +rm $LEFTBNW +rm $RIGHTBNW +rm $DIFFGIF -- 1.7.3.4