% TeXdraw macros to access PostScript builtins

% $Id: txdps.tex,v 1.7 1993/04/10 texdraw-V2R0 $

%   Copyright (C) 1991, 1992  Peter Kabal

% The routines in this file are provided free of charge without
% warranty of any kind.  Note that the TeXdraw routines are copyrighted.
% They may be distributed freely provided that the recipients also
% acquire the right to distribute them freely.  The notices to this
% effect must be preserved when the files are distributed.

%  Peter Kabal
%  Department of Electrical Engineering
%  McGill University
%  3480 University
%  Montreal, Quebec
%  Canada  H3A 2A7

%  kabal@TSP.EE.McGill.CA
 
% ===============================================================

\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
