summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/eepic/eepic.sty
blob: 29446873f0671caca20e2d8b341b9fb2a7630728 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
% eepic Version 1.1e < Dec 21, 1999 >
% Updated by Piet van Oostrum <piet@cs.uu.nl>
% eepic Version 1.1c < Nov 25, 1998 >
% Updated by Piet van Oostrum <piet@cs.uu.nl>
% eepic Version 1.1b < Febrary 7, 1988 >
%       Written by Conrad Kwok
%
% Internet : kwok@iris.ucdavis.edu
% csnet    : kwok@ucd.csnet
% csnet    : kwok%iris.ucdavis.edu@csnet.relay
% UUCP     : ...!ucbvax!ucdavis!iris!kwok
%
% The macros are in public domain.
% You may distribute or modify it in any ways you like.
% Please report any bugs, enhancements, comments, suggestions, etc.
%
% This style file modify some of the commands in epic[1] and LaTeX[2] such
% that \special commands will be generated in drawing lines if approriate.
% The \special commands generated is the subset of the \specials used
% by tpic[3].
%
% [1] epic is written by Sunil Podar. Please read epic.sty for the
%     copyright notice.
% [2] LaTeX is written by Leslie Lamport. Please read the book LaTeX
% [3] tpic is modified from pic by Tim Morgan
%
%% This file contains extensions of the following epic commands:
%%      \dottedline     \dashline       \drawline
%%      \jput
%%
%% It also contains extensions of the following LaTeX commands:
%%      \circle         \line           \oval
%%
%% New commands include:
%%      \Thicklines     \arc            \ellipse
%%      \path           \spline         \allinethickness
%%
%% New commands for eepic 1.1
%%      \blacken        \whiten         \shade
%%      \texture        \filltype{type} type=black|white|shade
%%
%% For documentation, please see the accompanying manual
%%
%% Change Log;
%% o    (October 2, 88)
%%      Fixed the problem of \line (\@sline). When both x and y are
%%      large, it produced 'bad character code' error.
%%
%% o    (January 17, 89)
%%      Add commands \blacken, \whiten, \shade, \texture
%%
%% o    (January 17, 89)
%%      Add \filltype{xxxxx}
%%      xxxxx - black, white, shade
%%
\typeout{%
Extension to Epic and LaTeX. Version 1.1e - Released Dec 21, 1999}
%
\newcount\@gphlinewidth
\newcount\@eepictcnt
\newdimen\@tempdimc
\@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736

%% Redefine \thinlines, \thicklines
%% See also latex.tex
\def\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc
    \@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth
    \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736\relax}
\def\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw
    \@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth
    \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736
    \advance\@gphlinewidth\@ne   % Make the output looks better
    \relax}
%%
%% To indicate whether the dot character is defined in the dotted join
%%     environment or not (\@ifnodotdef)
\newif\if@nodotdef \global\@nodotdeftrue
%%
%% Redefine \dottedjoin
\def\dottedjoin{\global\@jointhemtrue \global\@joinkind=0\relax
  \bgroup\@ifnextchar[{\global\@nodotdeffalse\@idottedjoin}%
                      {\global\@nodotdeftrue\@idottedjoin[\@empty]}}
%%----------------------------------------------------------------------
%% Redefine \jput
\long\def\jput(#1,#2)#3{\@killglue\raise#2\unitlength\hbox to \z@{\hskip
#1\unitlength #3\hss}%
\if@jointhem \if@firstpoint \gdef\x@one{#1} \gdef\y@one{#2} \global\@firstpointfalse
 \else\ifcase\@joinkind
    \if@nodotdef
        \@spdottedline{\dotgap@join\unitlength}%
(\x@one\unitlength ,\y@one\unitlength)(#1\unitlength,#2\unitlength)
    \else
        \@dottedline[\dotchar@join]{\dotgap@join\unitlength}%
(\x@one\unitlength,\y@one\unitlength)(#1\unitlength,#2\unitlength)
    \fi
        \or\@dashline[\dashlinestretch]{\dashlen@join\unitlength}[\dotgap@join]%
(\x@one,\y@one)(#1,#2)
        \else\@drawline[\drawlinestretch](\x@one,\y@one)(#1,#2)\fi
    \gdef\x@one{#1}\gdef\y@one{#2}%
 \fi
\fi\ignorespaces}
%%
%% Redefine \dottedline to generate special whenever possible.
\def\dottedline{\@ifnextchar [{\@idottedline}{\@ispdottedline}}
%% Similar to \@idottedline but it generate \special
\def\@ispdottedline#1(#2,#3){\@ifnextchar (%
{\@iispdottedline{#1}(#2,#3)}{\relax}}
\def\@iispdottedline#1(#2,#3)(#4,#5){\@spdottedline{#1\unitlength}%
(#2\unitlength,#3\unitlength)(#4\unitlength,#5\unitlength)%
\@ispdottedline{#1}(#4,#5)}
%
\def\@spdottedline#1(#2,#3)(#4,#5){%
    \@killglue % This line added by Piet van Oostrum, Dec 21, 1999.
    \@tempcnta \@gphlinewidth\relax
    \advance\@tempcnta by 2     % solely for better output
    \special{pn \the\@tempcnta}%
    \@tempdimc=#2\relax
    \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736
    \@tempdimc=#3\relax
    \@tempcntb -\@tempdimc\relax\advance\@tempcntb -2368 \divide\@tempcntb 4736
    \@paspecial{\the\@tempcnta}{\the\@tempcntb}%
    \@tempdimc=#4\relax
    \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736
    \@tempdimc=#5\relax
    \@tempcntb -\@tempdimc\relax\advance\@tempcntb -2368 \divide\@tempcntb 4736
    \@paspecial{\the\@tempcnta}{\the\@tempcntb}%
    \@tempdimc=#1\relax
%%
%% Generate the pen width in terms of inch with 3 decimal digit.
    \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736
%% \@tempcnta contain the pen width in terms of thousandth of a inch
%% Then it is converted back to inch. I know the way I use is dumb but
%% I cannot think of any better method
    \@tempcntb \@tempcnta\relax \divide\@tempcntb 1000
    \multiply \@tempcntb 1000 \advance\@tempcnta -\@tempcntb
    \divide\@tempcntb 1000
    \ifnum\@tempcnta < 10
        \special{dt \the\@tempcntb.00\the\@tempcnta}%
    \else\ifnum\@tempcnta < 100
        \special{dt \the\@tempcntb.0\the\@tempcnta}%
    \else
        \special{dt \the\@tempcntb.\the\@tempcnta}%
    \fi\fi
    \ignorespaces
}
%
\def\@iiidashline[#1]#2[#3](#4,#5)(#6,#7){%
\@dashline[#1]{#2\unitlength}[#3](#4,#5)(#6,#7)%
\@iidashline[#1]{#2}[#3](#6,#7)}
%
%% Redefine \@dashline
\long\def\@dashline[#1]#2[#3](#4,#5)(#6,#7){{%
\x@diff=#6\unitlength \advance\x@diff by -#4\unitlength
\y@diff=#7\unitlength \advance\y@diff by -#5\unitlength
%% correction to get actual width since the dash-length as taken in arguement
%% is the center-to-center of the end-points.
\@tempdima=#2\relax \advance\@tempdima -\@wholewidth
\sqrtandstuff{\x@diff}{\y@diff}{\@tempdima}%
\ifnum\num@segments <3 \num@segments=3\fi% min number of dashes I can plot
% is 2, 1 at either end, thus min num@segments is 3 (including 'empty dash').
\@tempdima=\x@diff \@tempdimb=\y@diff
\divide\@tempdimb by\num@segments
\divide\@tempdima by\num@segments
%% ugly if-then-else. If optional dotgap specified, then use it otherwise
%% make a solid dash.
{\ifx#3\@empty \relax
    \ifdim\@tempdima < 0pt \x@diff=-\@tempdima\else\x@diff=\@tempdima\fi
    \ifdim\@tempdimb < 0pt \y@diff=-\@tempdimb\else\y@diff=\@tempdimb\fi
    \global\setbox\@dotbox\hbox{%
                \@absspdrawline(0pt,0pt)(\@tempdima,\@tempdimb)}%
    \else\global\setbox\@dotbox\hbox{%
        \@spdottedline{#3\unitlength}(0pt,0pt)(\@tempdima,\@tempdimb)}%
    \fi}%
\advance\x@diff by -\@tempdima % both have same sign
\advance\y@diff by -\@tempdimb
%
%%here we correct the number of dashes to be put by reducing them
%%appropriately. (num@segments*\@wholewidth) is in some way the slack we
%%have,and division by dash-length gives the reduction. reduction =
%%(2*num@segments*\@wholewidth)/dash-length
%% (num@segments includes empty ones)
\@tempdima=\num@segments\@wholewidth \@tempdima=2\@tempdima
\@tempcnta\@tempdima\relax \@tempdima=#2\relax \@tempdimb=0.5\@tempdima
\@tempcntb\@tempdimb\relax \advance\@tempcnta by \@tempcntb % round-off error
\divide\@tempcnta by\@tempdima \advance\num@segments by -\@tempcnta
%
\ifnum #1=0 \relax\else\ifnum #1 < -100
  \typeout{***dashline: reduction > -100 percent implies blankness!***}
\else\num@segmentsi=#1 \advance\num@segmentsi by 100
     \multiply\num@segments by\num@segmentsi \divide\num@segments by 100
\fi\fi
%
\divide\num@segments by 2 % earlier num@segments included 'empty dashes' too.
\ifnum\num@segments >0 % if =0 then don't divide => \x@diff & \y@diff
 \divide\x@diff by\num@segments%   remain same.
 \divide\y@diff by\num@segments
 \advance\num@segments by\@ne %for the last segment for which I subtracted
                             %\@tempdima & \@tempdimb from \x@diff & \y@diff
 \else\num@segments=2 % one at each end.
\fi
%%\typeout{num@segments finally = \the\num@segments}
%% equiv to \multiput(#4,#5)(\x@diff,\y@diff){\num@segments}{\copy\@dotbox}
%% with arguements in absolute dimensions.
\@xdim=#4\unitlength \@ydim=#5\unitlength
\@killglue
\loop \ifnum\num@segments > 0
\unskip\raise\@ydim\hbox to\z@{\hskip\@xdim \copy\@dotbox\hss}%
\advance\num@segments \m@ne\advance\@xdim\x@diff\advance\@ydim\y@diff%
\repeat}%
\ignorespaces}
%% redefine \@drawline
%
\def\@drawline[#1](#2,#3)(#4,#5){{%
\@drawitfalse\@horvlinefalse
\ifnum#1 <0 \relax\else\@horvlinetrue\fi
\if@horvline
 \@spdrawline(#2,#3)(#4,#5)
\else\@drawittrue\fi
%%-------------------------------
\if@drawit
\ifnum #1=0 \relax \else\ifnum #1 < -99
  \typeout{***drawline: reduction <= -100 percent implies blankness!***}%
\else\num@segmentsi=#1 \advance\num@segmentsi by 50
     \multiply\num@segmentsi 2
\fi\fi
\@dashline[\num@segmentsi]{10pt}[\@empty](#2,#3)(#4,#5)
\fi}\ignorespaces}% for \if@drawit
%
\def\@spdrawline(#1,#2)(#3,#4){%
   \@absspdrawline(#1\unitlength,#2\unitlength)(#3\unitlength,#4\unitlength)
   \ignorespaces
}
\def\@absspdrawline(#1,#2)(#3,#4){%
    \@killglue % This line added by Piet van Oostrum, Dec 21, 1999.
    \special{pn \the\@gphlinewidth}%
    \@tempdimc=#1\relax
    \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736
    \@tempdimc=#2\relax
    \@tempcntb -\@tempdimc\relax \advance\@tempcntb -2368 \divide\@tempcntb 4736
    \@paspecial{\the\@tempcnta}{\the\@tempcntb}%
    \@tempdimc=#3\relax
    \@tempcnta\@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736
    \@tempdimc=#4\relax
    \@tempcntb -\@tempdimc\relax \advance\@tempcntb -2368 \divide\@tempcntb 4736
    \@paspecial{\the\@tempcnta}{\the\@tempcntb}%
    \special{fp}%
    \ignorespaces
}
%%----------------------------------------------------------------------
\def\@paspecial#1#2{%
    \special{pa #1 #2}%
}
%%
%% Functions below modify the LaTeX commands and some additional commands
%% are not supported by LaTeX nor epic such as ThickLines and arc.
%%
%% The macros are for use with LaTeX picture environment
%% By including the macro file, you can draw
%%   1) \line in any slope
%%   2) \circle with any radius
%%   3) \ellipse with any x-axis and y-axis length
%%   4) Circular \arc by giving starting and ending angle (in radius)
%%
%% Furthermore you may draw lines in any thickness.
%%
%%
%% Redefine \thinlines, \thicklines and define \Thickline
%% See also latex.tex
\def\Thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw
    \@wholewidth\fontdimen8\tenlnw \@wholewidth 1.5\@wholewidth
    \@halfwidth .5\@wholewidth
    \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736\relax}
%%
%% Generate the \special command for drawing arc
\def\@circlespecial#1#2#3#4{%
              \special{pn \the\@gphlinewidth}%
              \special{ar 0 0 #1 #2 #3 #4}
}
%%
%% Command for drawing an arc. Elliptical arc command can be generated
%% but all iptex program I saw so far does not support that.
\def\@arc#1#2#3#4{%
%% convert TeX dimension to length in terms thousandth of an inch
        \@tempdima #1\unitlength
        \@tempdimb #2\unitlength
        \@tempcnta\@tempdima \advance\@tempcnta 4736 \divide\@tempcnta 9473
        \@tempcntb\@tempdimb \advance\@tempcntb 4736 \divide\@tempcntb 9473
        \setbox\@tempboxa\hbox{%
            \@circlespecial{\the\@tempcnta}{\the\@tempcntb}{#3}{#4}}%
        \wd\@tempboxa\z@ \box\@tempboxa}
%%
%% Command for drawing Circle and Ellipse in terms of \@arc
%% replace original \circle
\def\circle{%
    \@ifstar{\copy\@filltype\@circle}{\@circle}}
\def\@circle#1{\@arc{#1}{#1}{0}{6.2832}}
\def\ellipse{%
    \@ifstar{\copy\@filltype\@ellipse}{\@ellipse}}
\def\@ellipse#1#2{{\@arc{#1}{#2}{0}{6.2832}}}
\def\arc#1#2#3{\@arc{#1}{#1}{#2}{#3}}
%%
%% Generate \special commands for drawing line
\def\@linespecial#1#2{%
              \special{pn \the\@gphlinewidth}%
              \special{pa 0 0}%
              \special{pa #1 #2}%
              \special{fp}%
}
%% Replace original \line. Only change is to call \@ssline instead
%% of \@sline. For description, see latex.tex
\def\line(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
\@linelen=#3\unitlength
\ifnum\@xarg =0 \@vline 
  \else \ifnum\@yarg =0 \@hline \else \@ssline\fi
\fi}
%%
\def\@ssline{%
        \ifnum\@xarg< 0
          \@negargtrue \@xarg -\@xarg \@tempdima -\@linelen
        \else
          \@negargfalse \@tempdima\@linelen
        \fi
%% truncation is used in arithmetic
        \@tempcnta\@linelen \divide\@tempcnta 4736
        \@yyarg -\@yarg \multiply\@yyarg \@tempcnta \divide\@yyarg\@xarg
        \if@negarg
            \@tempcnta -\@tempcnta
        \fi
        \setbox\@linechar\hbox{\@linespecial{\the\@tempcnta}{\the\@yyarg}}%
        \wd\@linechar\@tempdima
        \@clnht\@linelen
        \multiply\@clnht\@yarg
        \divide\@clnht\@xarg
        \ifnum\@yarg< 0
          \@clnht -\@clnht
          \ht\@linechar\z@ \dp\@linechar\@clnht
        \else
          \ht\@linechar\@clnht \dp\@linechar\z@
        \fi
        \box\@linechar
}
%%
%% Replace original \@sline
\def\@sline{%
        \@ssline
%% Codes below (till end of the command) is only necessary
%% when used with \@svector
        \if@negarg
          \@yyarg -\@yarg
        \else
          \@yyarg \@yarg
        \fi
        \setbox\@linechar\hbox{\@linefnt\@getlinechar(\@xarg,\@yyarg)}%
        \ifnum\@yarg> 0
          \let\@upordown\raise
          \advance\@clnht -\ht\@linechar
        \else
          \let\@upordown\lower
        \fi
        \if@negarg \kern\wd\@linechar \fi
}
%%
\def\spline(#1,#2){%
    \@killglue % This line added by Piet van Oostrum, Dec 21, 1999.
    \special{pn \the\@gphlinewidth}%
    \@spline(#1,#2)%
}
\def\@spline(#1,#2){%
    \@tempdima #1\unitlength
    \@tempdimb #2\unitlength
    \@tempcnta \@tempdima \advance\@tempcnta 2368 \divide\@tempcnta 4736
    \@tempcntb -\@tempdimb \advance\@tempcntb -2368 \divide\@tempcntb 4736
    \@paspecial{\the\@tempcnta}{\the\@tempcntb}%
    \@ifnextchar ({\@spline}{\special{sp}}%
}
\def\path(#1,#2){%
    \@killglue % This line added by Piet van Oostrum, Dec 20, 1999.
    \special{pn \the\@gphlinewidth}%
    \@path(#1,#2)%
}
\def\@path(#1,#2){%
    \@tempdima #1\unitlength
    \@tempdimb #2\unitlength
    \@tempcnta \@tempdima \advance\@tempcnta 2368 \divide\@tempcnta 4736
    \@tempcntb -\@tempdimb \advance\@tempcntb -2368 \divide\@tempcntb 4736
    \@paspecial{\the\@tempcnta}{\the\@tempcntb}%
    \@ifnextchar ({\@path}{\special{fp}}%
}

%%%%%%%%%% Beginning of \oval %%%%%%%%%%%%%%%
\newdimen\maxovaldiam \maxovaldiam 40pt\relax

\def\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen
  \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue
  \@tfor\@tempa :=#3\do{\csname @ov\@tempa false\endcsname}\@ovxx
  #1\unitlength \@ovyy #2\unitlength
  \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi
  \@ovro \ifdim \@tempdimb>\maxovaldiam \maxovaldiam\else\@tempdimb\fi\relax
  \divide \@ovro \tw@
  \@ovdx\@ovxx \divide\@ovdx \tw@
  \@ovdy\@ovyy \divide\@ovdy \tw@
  \setbox\@tempboxa \hbox{%
  \if@ovr \@ovverta\fi
  \if@ovl \kern \@ovxx \@ovvertb\kern -\@ovxx \fi
  \if@ovt \@ovhorz \kern -\@ovxx \fi
  \if@ovb \raise \@ovyy \@ovhorz \fi}% Update by Piet van Oostrum (% added)
  \ht\@tempboxa\z@ \dp\@tempboxa\z@
  \@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa}%
  \endgroup}

\def\@qcirc#1#2#3#4{%
    \special{pn \the\@gphlinewidth}%
    \@eepictcnt \@gphlinewidth \divide\@eepictcnt 2
    \@tempcnta #1 
      \advance\@tempcnta 2368 \divide\@tempcnta 4736
      \advance\@tempcnta\@eepictcnt
    \@tempcntb #2 \divide\@tempcntb 4736 \advance\@tempcntb 2
    \hbox{%
        \@qcircspecial{\the\@tempcnta}{-\the\@eepictcnt}{\the\@tempcntb}{#3}{#4}}%
}
\def\@qcircspecial#1#2#3#4#5{\special{ar #1 #2 #3 #3 #4 #5}}

\def\@ovverta{\vbox to \@ovyy{%
    \if@ovb
        \kern \@ovro
        \@qcirc{\@ovro}{\@ovro}{3.1416}{4.7124}\nointerlineskip
    \else
        \kern \@ovdy
    \fi
    \leaders\vrule width \@wholewidth\vfil \nointerlineskip
    \if@ovt
        \@qcirc{\@ovro}{\@ovro}{1.5708}{3.1416}\nointerlineskip
        \kern \@ovro
    \else
        \kern \@ovdy
    \fi
}\kern -\@wholewidth}

\def\@ovvertb{\vbox to \@ovyy{%
    \if@ovb
        \kern \@ovro
        \@qcirc{-\@ovro}{\@ovro}{4.6124}{6.2832}\nointerlineskip
    \else
        \kern \@ovdy
    \fi
    \leaders\vrule width \@wholewidth\vfil \nointerlineskip
    \if@ovt
        \@qcirc{-\@ovro}{\@ovro}{0}{1.6708}\nointerlineskip
        \kern \@ovro
    \else
        \kern \@ovdy
    \fi
}\kern -\@wholewidth}

\def\@ovhorz{\hbox to \@ovxx{%
    \if@ovr \kern \@ovro\else \kern \@ovdx \fi
    \leaders \hrule height \@wholewidth \hfil
    \if@ovl \kern \@ovro\else \kern \@ovdx \fi
    }}
%%%%%%%%% End of \oval %%%%%%%%%%%%%%

\def\allinethickness#1{\let\@linefnt\tenlnw \let\@circlefnt\tencircw
    \@wholewidth #1 \@halfwidth .5\@wholewidth
    \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736\relax}

\def\blacken{\special{bk}}
\def\whiten{\special{wh}}
\def\shade{\special{sh}}
\def\texture#1{\special{tx #1}\ignorespaces}
%% 
\newbox\@filltype
\setbox\@filltype\hbox{\special{bk}}
\def\filltype#1{\@nameuse{ft@#1}}
\def\ft@black{\setbox\@filltype\hbox{\special{bk}}}
\def\ft@white{\setbox\@filltype\hbox{\special{wh}}}
\def\ft@shade{\setbox\@filltype\hbox{\special{sh}}}
%%