| 1 |
divert(-1) |
| 2 |
postscript.m4 Initialization for Postscript output. |
| 3 |
|
| 4 |
* Circuit_macros Version 11.0, copyright (c) 2026 J. D. Aplevich under * |
| 5 |
* the LaTeX Project Public Licence in file Licence.txt. The files of * |
| 6 |
* this distribution may be redistributed or modified provided that this * |
| 7 |
* copyright notice is included and provided that modifications are clearly * |
| 8 |
* marked to distinguish them from this distribution. There is no warranty * |
| 9 |
* whatsoever for these files. * |
| 10 |
|
| 11 |
define(`m4picprocessor',dpic) |
| 12 |
define(`m4postprocessor',postscript) |
| 13 |
|
| 14 |
ifdef(`libgen_',,`include(libgen.m4)divert(-1)')dnl |
| 15 |
|
| 16 |
Color utilities |
| 17 |
define(`setrgb',`pushdef(`r_',`$1')pushdef(`g_',`$2')pushdef(`b_',`$3')dnl |
| 18 |
pushdef(`m4cl_',ifelse(`$4',,lcspec,`$4'))dnl |
| 19 |
command sprintf(" /m4cl_ {%7.5f %7.5f %7.5f} def",r_,g_,b_) |
| 20 |
command " m4cl_ setrgbcolor"') |
| 21 |
|
| 22 |
define(`resetrgb',`popdef(`m4cl_')popdef(`r_')popdef(`g_')popdef(`b_')dnl |
| 23 |
ifdef(`r_', |
| 24 |
`command sprintf(" %7.5f %7.5f %7.5f setrgbcolor",r_,g_,b_)', |
| 25 |
`command " 0 0 0 setrgbcolor"') ') |
| 26 |
|
| 27 |
`rgbdraw(color triple, drawing commands)' |
| 28 |
define(`rgbdraw',`setrgb(`$1',`$2',`$3') |
| 29 |
shift(shift(shift($@))) |
| 30 |
resetrgb') |
| 31 |
`rgbfill(color triple, closed path)' |
| 32 |
define(`rgbfill', |
| 33 |
`command " npath /npath {} def /endstroke {} def" |
| 34 |
ifm4_rgbtestcomma(`$1', |
| 35 |
`shift($@) |
| 36 |
command "gsave `$1' setrgbcolor"', |
| 37 |
`shift(shift(shift($@))) |
| 38 |
command sprintf("gsave %7.5f %7.5f %7.5f setrgbcolor", `$1',`$2',`$3')') |
| 39 |
command " fill grestore ostroke" |
| 40 |
command " /endstroke {ostroke} def /npath {newpath} def"') |
| 41 |
`Top-level test for comma' |
| 42 |
define(`ifm4_rgbtestcomma',`ifinstr(`$1',`,',`$2',`$3')') |
| 43 |
|
| 44 |
xcolor predefined colors |
| 45 |
define(`defineRGBprimaries',` |
| 46 |
command "/white {1 1 1} def |
| 47 |
/lightgrey {0.75 0.75 0.75} def |
| 48 |
/lightgray {0.75 0.75 0.75} def |
| 49 |
/grey {0.5 0.5 0.5} def |
| 50 |
/gray {0.5 0.5 0.5} def |
| 51 |
/darkgrey {0.25 0.25 0.25} def |
| 52 |
/darkgray {0.25 0.25 0.25} def |
| 53 |
/black {0 0 0} def |
| 54 |
/red {1 0 0} def |
| 55 |
/green {0 1 0} def |
| 56 |
/blue {0 0 1} def |
| 57 |
/cyan {0 1 1} def |
| 58 |
/magenta {1 0 1} def |
| 59 |
/yellow {1 1 0} def |
| 60 |
/brown {0.59 0.29 0} def |
| 61 |
/lime {0.8 1 0} def |
| 62 |
/olive {0.5 0.5 0} def |
| 63 |
/orange {1 0.5 0} def |
| 64 |
/pink {1 0.75 0.8} def |
| 65 |
/purple {0.5 0 0.5} def |
| 66 |
/teal {0 0.5 0.5} def |
| 67 |
/violet {0.56 0 1} def"') |
| 68 |
|
| 69 |
define(`thinlines_',`linethick = 0.4 |
| 70 |
arrowwid = 0.04*scale; arrowht = 0.2/3*scale |
| 71 |
command " 0.4 setlinewidth";') |
| 72 |
define(`thicklines_',`linethick = 0.8 |
| 73 |
arrowwid = 0.05*scale; arrowht = 0.1*scale |
| 74 |
command " 0.8 setlinewidth";') |
| 75 |
`linethick_(x) |
| 76 |
set line width to x pt (default 0.8) |
| 77 |
and scale arrowhead parameters' |
| 78 |
define(`linethick_',`linethick = ifelse(`$1',,`0.8',`$1'); dnl |
| 79 |
arrowwid = ifelse(`$1',,`0.05',linethick/16)*scale; dnl |
| 80 |
arrowht = ifelse(`$1',,`0.1',linethick/8)*scale;') |
| 81 |
|
| 82 |
divert(0)dnl |