| 1 |
#!/bin/sh -e |
| 2 |
# ========================================================================== |
| 3 |
# _ _ _ ____ ____ _____ |
| 4 |
# | | | (_) _ \ ___ _ __ / ___|___ _ _|_ _| __ __ _ ___ ___ _ __ |
| 5 |
# | |_| | | |_) / _ \ '__| | / _ \| '_ \| || '__/ _` |/ __/ _ \ '__| |
| 6 |
# | _ | | __/ __/ | | |__| (_) | | | | || | | (_| | (_| __/ | |
| 7 |
# |_| |_|_|_| \___|_| \____\___/|_| |_|_||_| \__,_|\___\___|_| |
| 8 |
# |
| 9 |
# --- High-Performance Connectivity Tracer (HiPerConTracer) --- |
| 10 |
# https://www.nntb.no/~dreibh/hipercontracer/ |
| 11 |
# ========================================================================== |
| 12 |
# |
| 13 |
# High-Performance Connectivity Tracer (HiPerConTracer) |
| 14 |
# Copyright (C) 2015-2026 by Thomas Dreibholz |
| 15 |
# |
| 16 |
# This program is free software: you can redistribute it and/or modify |
| 17 |
# it under the terms of the GNU General Public License as published by |
| 18 |
# the Free Software Foundation, either version 3 of the License, or |
| 19 |
# (at your option) any later version. |
| 20 |
# |
| 21 |
# This program is distributed in the hope that it will be useful, |
| 22 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 24 |
# GNU General Public License for more details. |
| 25 |
# |
| 26 |
# You should have received a copy of the GNU General Public License |
| 27 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 28 |
# |
| 29 |
# Contact: [email protected] |
| 30 |
|
| 31 |
INPUT="Logo-HiPerConTracer.dia" |
| 32 |
OUTPUT="hipercontracer" |
| 33 |
|
| 34 |
# ====== Export Dia to PDF ================================================== |
| 35 |
dia -n -t cairo-pdf -e "${OUTPUT}.pdf1.tmp" "${INPUT}" |
| 36 |
|
| 37 |
# OLD: |
| 38 |
# dia -n -t eps-pango -e "${OUTPUT}.eps" "${INPUT}" |
| 39 |
# epstopdf --outfile="${OUTPUT}.pdf1.tmp" "${OUTPUT}.eps" |
| 40 |
|
| 41 |
pdfcrop --hires "${OUTPUT}.pdf1.tmp" "${OUTPUT}.pdf2.tmp" |
| 42 |
|
| 43 |
# ====== Make PDF with transparent background =============================== |
| 44 |
# The background is specified as something like: |
| 45 |
# 1 1 1 rg /a0 gs |
| 46 |
# 0 0 596 843 re f |
| 47 |
# => Remove the first occurrence only |
| 48 |
qpdf -qdf "${OUTPUT}.pdf2.tmp" "${OUTPUT}.qdf1.tmp" |
| 49 |
sed -e '0,/^.* re\( f\|\)$/s/^\(.* re\)\( f\|\)$/%% \1/' \ |
| 50 |
-e '0,/^1 1 1 rg\( .*\|\)$/s/^\(1 1 1 rg\)\( .*\|\)$/%% \1/' \ |
| 51 |
<"${OUTPUT}.qdf1.tmp" >"${OUTPUT}.qdf2.tmp" |
| 52 |
fix-qdf "${OUTPUT}.qdf2.tmp" >"${OUTPUT}.pdf" |
| 53 |
|
| 54 |
# ls -l "${OUTPUT}.qdf1.tmp" "${OUTPUT}.qdf2.tmp" |
| 55 |
# colordiff "${OUTPUT}.qdf1.tmp" "${OUTPUT}.qdf2.tmp" || true |
| 56 |
|
| 57 |
rm -f "${OUTPUT}.pdf1.tmp" "${OUTPUT}.pdf2.tmp" "${OUTPUT}.qdf1.tmp" "${OUTPUT}.qdf2.tmp" |