summaryrefslogtreecommitdiff
path: root/info/examples/lgc2/circuit/postscript.m4
blob: e72d9cc7386fe0659842f212ba8a56c8e347f65b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
divert(-1)
   postscript.m4                  Initialize macros for Postscript output.

* Circuit_macros Version 5.86, copyright (c) 2006 J. D. Aplevich, under    *
* the LaTeX Project Public License. The files of this distribution may be *
* redistributed or modified, provided that this copyright notice is       *
* included, and provided that modifications are clearly marked to         *
* distinguish them from this distribution.  There is no warranty          *
* whatsoever for these files.                                             *

                                Installation directory.  You can set this to
                                the null string if you use an environment
                                variable to tell m4 where to search:
ifdef(`HOMELIB_',,
 `define(`HOMELIB_',`./circuit/')')
#`define(`HOMELIB_',`C:\Dwight\lib\')')

define(`m4picprocessor',dpic)
define(`m4postprocessor',postscript)

ifdef(`up_',,`include(HOMELIB_`'libgen.m4)divert(-1)')dnl

                                Color utilities
define(`setrgb',`pushdef(`r_',`$1')pushdef(`g_',`$2')pushdef(`b_',`$3')dnl
 command " r_ g_ b_ setrgbcolor"')

define(`resetrgb',`dnl
popdef(`r_')ifdef(`r_',,`define(`r_',0)')dnl
popdef(`g_')ifdef(`g_',,`define(`g_',0)')dnl
popdef(`b_')ifdef(`b_',,`define(`b_',0)')dnl
 command " r_ g_ b_ setrgbcolor"')

                                `rgbdraw(color triple, drawing commands)'
define(`rgbdraw',`setrgb(`$1',`$2',`$3')
  shift(shift(shift($@)))
  resetrgb')
                                `rgbfill(color triple, closed path)'
                                `This ought to be fixed to work for nonconvex
                                 areas'
define(`rgbfill',
 `command sprintf("/endstroke { gsave %g %g %g setrgbcolor",`$1',`$2',`$3')
  command " fill grestore ostroke } def"
  shift(shift(shift($@)))
  command "/endstroke {ostroke} def" ')

define(`thinlines_',`linethick = 0.4
 arrowwid = 0.04*scale; arrowht = 0.2/3*scale
 command " 0.4 setlinewidth";')
define(`thicklines_',`linethick = 0.8
 arrowwid = 0.05*scale; arrowht = 0.1*scale
 command " 0.8 setlinewidth";')
                                `linethick_(x) set line width to x pt'
define(`linethick_',`linethick = ifelse(`$1',,`0.8',`$1'); dnl
 arrowwid = ifelse(`$1',,`0.05',(`$1')/16)*scale; dnl
 arrowht = ifelse(`$1',,`0.1',(`$1')/8)*scale;')
divert(0)dnl