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