[pstricks] Re: linestyle=dashdot?

Etienne Riga etienne.riga at skynet.be
Thu May 23 15:55:36 CEST 2002


%%  Selon communication de Denis Girou 25-3-98
%%  Extension du dash pattern à la PiCTeX

\edef\PstAtCode{\the\catcode`\@}
\catcode`\@\letter
\def\pst at empty{\z@}
\def\psset at dash#1{%
\pst at expandafter\psset@@dash{#1} {\pst at empty} {\pst at empty}
                                 {\pst at missing} {\pst at missing} {}\@nil
\edef\psk at dash{\pst at number\pst at dimg \pst at number\pst at dimh
               \pst at number\pst at dimc \pst at number\pst at dimd}}
\def\psset@@dash#1 #2 #3 #4 #5\@nil{%
\pssetlength\pst at dimg{#1}%
\pssetlength\pst at dimh{#2}%
\pssetlength\pst at dimc{#3}%
\pssetlength\pst at dimd{#4}}
\psset at dash{5pt 3pt}

\pst at def{DashLine}<%
dup 0 gt { /a .5 def PathLength exch div } { pop /a 1 def PathLength }
ifelse
/b ED /x1 ED /y1 ED /x ED /y ED
/z y x add y1 add x1 add def
/Coef b a .5 sub 2 mul y mul sub z Div round
z mul a .5 sub 2 mul y mul add b exch Div def
/y y Coef mul def /x x Coef mul def /y1 y1 Coef mul def /x1 x1 Coef mul def
x1 0 gt y1 0 gt x 0 gt y 0 gt and { [ y x y1 x1 ] 1 a sub y mul}
{ [ 1 0] 0 } ifelse setdash stroke>

\catcode`\@=\PstAtCode\relax

Example:
\psline[linestyle=dashed,dash=3pt 1pt 1pt 1pt](0,0)(10,10)

--
Bien à vous
Étienne Riga




More information about the PSTricks mailing list