summaryrefslogtreecommitdiff
path: root/graphics/texdraw/txdps.tex
blob: 482e3faf4089c0f84d28253dddace772daaa1414 (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
% TeXdraw macros to access PostScript builtins

% $Id: txdps.tex 1.10 2019/04/18 TeXdraw-v2r3 $

%   Copyright (C) 1991-2019  Peter Kabal

% This work is licensed under the Creative Commons Attribution (CC-BY)
% License, any version. To view the licenses, visit
% creativecommons.org/licenses/by or send a letter to
% Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

%  Peter Kabal
%  Department of Electrical & Computer Engineering
%  McGill University

%  peter dot kabal at mcgill dot ca
%  http://www-mmsp.ece.mcgill.ca/MMSP/Documents/Software/

% ===============================================================

\chardef\catamp=\the\catcode`\@
\catcode`\@=11

% The TeXdraw macros assume that a PostScript currentpoint is always
% defined. When using the following macros, always finish off with
% by reestablishing a PostScript currentpoint. This can be done with
% a \PSmoveto command.

\def\PSsetlinecap #1 {\writeps{#1 setlinecap}}
\def\PSsetlinejoin #1 {\writeps{#1 setlinejoin}}
\def\PSstroke {\writeps{stroke}}
\def\PSnewpath {\writeps{newpath}}
\def\PSclosepath {\writeps{closepath}}
\def\PSfill {\writeps{fill}}
\def\PSlineto (#1 #2){\getpos (#1 #2)\a@rgx\a@rgy
                      \s@etpospix \a@rgx \a@rgy
                      \writeps {\the\x@pix\space \the\y@pix\space lineto}}
\def\PSmoveto (#1 #2){\getpos (#1 #2)\a@rgx\a@rgy
                      \s@etpospix \a@rgx \a@rgy
                      \writeps {\the\x@pix\space \the\y@pix\space moveto}}
\def\PSarc r:#1 sd:#2 ed:#3 (#4 #5){\getpos (#4 #5)\a@rgx\a@rgy
                                    \s@etpospix \a@rgx \a@rgy
                                    \coordtopix {#1}\t@pixa
                                    \writeps{\the\x@pix\space \the\y@pix\space
                                             \the\t@pixa\space #2 #3 arc}}
\def\PSarcn r:#1 sd:#2 ed:#3 (#4 #5){\getpos (#4 #5)\a@rgx\a@rgy
                                     \s@etpospix \a@rgx \a@rgy
                                     \coordtopix {#1}\t@pixa
                                     \writeps{\the\x@pix\space \the\y@pix\space
                                              \the\t@pixa\space #2 #3 arcn}}

\catcode`\@=\catamp