diff options
author | Karl Berry <karl@freefriends.org> | 2010-02-11 23:48:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-02-11 23:48:39 +0000 |
commit | a82c24b304d3a6727a9cd210d82b33b2c9e3119b (patch) | |
tree | 2f331ad49c6edf41f80a30eda60945397bb38428 /Master/texmf-dist/dvips/pstricks/pstricks.pro | |
parent | b164898a09f10287c030149a0a36c7938627a9c3 (diff) |
pstricks 0.41 (11feb10)
git-svn-id: svn://tug.org/texlive/trunk@16973 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/dvips/pstricks/pstricks.pro')
-rw-r--r-- | Master/texmf-dist/dvips/pstricks/pstricks.pro | 317 |
1 files changed, 256 insertions, 61 deletions
diff --git a/Master/texmf-dist/dvips/pstricks/pstricks.pro b/Master/texmf-dist/dvips/pstricks/pstricks.pro index fa156bb7488..19096f3f05c 100644 --- a/Master/texmf-dist/dvips/pstricks/pstricks.pro +++ b/Master/texmf-dist/dvips/pstricks/pstricks.pro @@ -1,4 +1,4 @@ -% $Id: pstricks.pro 90 2009-01-30 10:58:51Z herbert $ +% $Id: pstricks.pro 266 2010-01-22 14:45:23Z herbert $ % %% PostScript prologue for pstricks.tex. %% Version 1.06, 2009/01/30 @@ -72,28 +72,29 @@ tx@Dict begin /STP { .996264 dup scale } def % BP/PT scaling /STV { SDict begin normalscale end STP } def % % -%%-------------- DG begin patch 15 ---------------%% -%/DashLine { dup 0 gt { /a .5 def PathLength exch div } { pop /a 1 def -%PathLength } ifelse /b ED /x ED /y ED /z y x add def 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 dup y mul -%/y ED x mul /x ED x 0 gt y 0 gt and { [ y x ] 1 a sub y mul } { [ 1 0 ] -%0 } ifelse setdash stroke } 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 or x 0 gt or y 0 gt and - { [ y x y1 x1 ] 1 a sub y mul } - { [ 1 0 ] 0 } ifelse - setdash stroke -} def -%%-------------- DG end patch 15 ---------------%% + dup 0 gt + { /a .5 def PathLength exch div } + { pop /a 1 def PathLength } ifelse + /b ED % pattern should fit evenly in b + dup /X ED % pattern array + 0 get /y ED % length of first black segment + /z 0 X {add} forall def % length of the full pattern + %% Computation of the scaling factor as described by van Zandt: + 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 + %%%% scaling factor on stack. + /z ED %% now, z is the scaling factor + false % for the length test below + X { z mul } forall X astore %% modification TN 04-08-07 + %%% Checking whether at least one dash in X has positive length: + {0 gt or} forall + { X 1 a sub y mul } + { [ 1 0 ] 0 } + ifelse + setdash stroke +} def +% /DotLine { /b PathLength def /a ED /z ED /y CLW def @@ -112,6 +113,35 @@ tx@Dict begin setdash 1 setlinecap stroke } def % +/SymbolLine { % on stack [ x y x y ... + counttomark % number of elements + 2 div cvi /n ED % n pairs + /YA ED /XA ED % the start point + n 1 sub { + /YB ED /XB ED + /XLength XB XA sub def + /YLength YB YA sub def + /PAngle YLength XLength Atan def + /XYLength XLength YLength Pyth def + /nSym XYLength SymStep div cvi def + /Shift Symbol stringwidth pop 2 div def + /deltaX XLength nSym div def + /deltaY YLength nSym div def + XA Shift sub YA Shift sub moveto + nSym { + gsave rotateSymbol { PAngle 180 sub CorrAngle sub rotate } if + Symbol show + grestore + deltaX deltaY rmoveto + } repeat + /YA YB def /XA XB def + } repeat + XA Shift sub YA Shift sub moveto + gsave rotateSymbol { PAngle 180 sub CorrAngle sub rotate } if + Symbol show grestore + pop % delete the mark symbol +} def +% /LineFill { % hv ------------ patch 7 ------------- gsave abs /hatchWidthInc ED @@ -167,21 +197,6 @@ tx@Dict begin pop pop } def % -%gsave abs CLW add /a ED a 0 dtransform round exch round exch -%2 copy idtransform exch Atan rotate idtransform pop /a ED .25 .25 -%% DG/SR modification begin - Dec. 12, 1997 - Patch 2 -%%itransform translate pathbbox /y2 ED a Div ceiling cvi /x2 ED /y1 ED a -%itransform pathbbox /y2 ED a Div ceiling cvi /x2 ED /y1 ED a -%% DG/SR modification end -%Div cvi /x1 ED /y2 y2 y1 sub def clip newpath 2 setlinecap systemdict -%/setstrokeadjust known { true setstrokeadjust } if x2 x1 sub 1 add { x1 -%% DG/SR modification begin - Jun. 1, 1998 - Patch 3 (from Michael Vulis) -%% a mul y1 moveto 0 y2 rlineto stroke /x1 x1 1 add def } repeat grestore } -%% def -%a mul y1 moveto 0 y2 rlineto stroke /x1 x1 1 add def } repeat grestore -%pop pop } def -%% DG/SR modification end -% /BeginArrow { ADict begin % hold it local, for end see EndArrow /@mtrx CM def @@ -253,24 +268,25 @@ tx@Dict begin /SD { 0 360 arc fill } def % /EndDot { % DS is the dot size - { /z DS def } { /z 0 def } ifelse - /b ED 0 z DS SD b { 0 z DS CLW sub SD } if - 0 DS z add CLW 4 div sub moveto } def + { /z DS def } { /z 0 def } ifelse % outer or inner dimen + /b ED % the color definition + 0 z DS SD + b { 0 z DS CLW sub SD } if + 0 DS z add CLW 4 div sub + moveto +} def % /Shadow { [ { /moveto load } { /lineto load } { /curveto load } { /closepath load } /pathforall load stopped { pop pop pop pop CP /moveto load } if ] cvx newpath 3 1 roll T exec } def % -%/NArray { -% aload length 2 div dup dup cvi eq not { exch pop } if /n exch -% cvi def -%} def -% /NArray { % holds the coordinates and on top of stack the showpoints boolean /showpoints ED - counttomark 2 div dup cvi /n ED - n eq not { exch pop } if - showpoints { ] aload /Points ED } { n 2 mul 1 add -1 roll pop } ifelse + counttomark 2 div dup cvi /n ED % n 2 div on stack + n eq not { exch pop } if % even numbers of points? delete one + showpoints + { ] aload /Points ED } + { n 2 mul 1 add -1 roll pop } ifelse % delete the mark symbol } def % /Line { @@ -281,6 +297,30 @@ tx@Dict begin } if } def % +/LineToYAxis { + NArray % all x-y pairs on stack + n { 2 copy moveto % go to current point + 0 exch Lineto % line to y-axis + pop % delete old x-value + } repeat +} def +% +/LineToXAxis{ + NArray % all x-y pairs on stack + n 0 eq not + { n 1 eq { 0 0 /n 2 def } if + ArrowA + /n n 2 sub def + CP 2 copy moveto pop 0 Lineto + n { 2 copy moveto pop 0 Lineto } repeat + CP + 4 2 roll + ArrowB + 2 copy moveto pop 0 + L + pop pop } if +} def +% /Arcto { /a [ 6 -2 roll ] cvx def a r @@ -288,13 +328,57 @@ tx@Dict begin a } def % -/CheckClosed { dup n 2 mul 1 sub index eq 2 index n 2 mul 1 add index eq - and { pop pop /n n 1 sub def } if } def -/Polygon { NArray n 2 eq { 0 0 /n 3 def } if n 3 lt { n { pop pop } - repeat } { n 3 gt { CheckClosed } if n 2 mul -2 roll /y0 ED /x0 ED /y1 - ED /x1 ED x1 y1 /x1 x0 x1 add 2 div def /y1 y0 y1 add 2 div def x1 y1 - moveto /n n 2 sub def n { Lineto } repeat x1 y1 x0 y0 6 4 roll Lineto - Lineto pop pop closepath } ifelse } def +/CheckClosed { + dup n 2 mul 1 sub index eq 2 index n 2 mul 1 add index eq + and { pop pop /n n 1 sub def } if +} def +% +/Polygon { + NArray n 2 eq { 0 0 /n 3 def } if + n 3 lt + { n { pop pop } repeat } + { n 3 gt { CheckClosed } if + n 2 mul -2 roll + /y0 ED /x0 ED /y1 ED /x1 ED + x1 y1 + /x1 x0 x1 add 2 div def + /y1 y0 y1 add 2 div def + x1 y1 moveto + /n n 2 sub def + n { Lineto } repeat + x1 y1 x0 y0 6 4 roll Lineto + Lineto pop pop closepath } ifelse +} def +% +/SymbolPolygon { % on stack [ x y x y ... + counttomark % number of elements + 2 add /m ED + 2 copy m 2 roll % copy last two + m 2 div cvi /n ED % n pairs + /YA ED /XA ED % the start point + n 1 sub { + /YB ED /XB ED + /XLength XB XA sub def + /YLength YB YA sub def + /PAngle YLength XLength Atan def + /XYLength XLength YLength Pyth def + /nSym XYLength SymStep Div cvi def + /Shift Symbol stringwidth pop 2 Div def + /deltaX XLength nSym Div def + /deltaY YLength nSym Div def + XA Shift sub YA Shift sub moveto + nSym { + gsave rotateSymbol { PAngle 180 sub CorrAngle sub rotate } if + Symbol show + grestore + deltaX deltaY rmoveto + } repeat +% XB Shift sub YB Shift sub moveto Symbol show + /YA YB def /XA XB def + } repeat + pop % delete the mark symbol +} def +% /Diamond { /mtrx CM def T rotate @@ -310,12 +394,6 @@ tx@Dict begin /ArrowB { } def false Line closepath mtrx setmatrix } def -% DG modification begin - Jan. 15, 1997 -%/Triangle { /mtrx CM def translate rotate /h ED 2 div /w ED dup 0 eq { -%pop } { CLW mul /d ED /h h d w h Atan sin Div sub def /w w d h w Atan 2 -%div dup cos exch sin Div mul sub def } ifelse mark 0 d w neg d 0 h w d 0 -%d /ArrowA { moveto } def /ArrowB { } def false Line closepath mtrx -%setmatrix } def % /Triangle { /mtrx CM def @@ -383,6 +461,39 @@ tx@Dict begin { BOC /n n 3 sub def n { NC } repeat EOC } ifelse } def % +/CurvePath { + flattenpath /z 0 def /z0 0 def + { /y1 ED /x1 ED /y2 y1 def /x2 x1 def + x1 Shift sub y1 Shift sub moveto + gsave + startAngle rotate Symbol show + grestore /z0 z def } + { /y ED /x ED PathLength@ z z0 sub SymStep ge { + x Shift sub y Shift sub moveto + gsave + rotateSymbol { y yOld sub x xOld sub Atan 180 sub CorrAngle sub rotate } if + Symbol show + grestore /z0 z def } if + /yOld y def /xOld x def } + {} + { /y y2 def /x x2 def PathLength@ + x Shift sub y Shift sub moveto + gsave + rotateSymbol { y yOld sub x xOld sub Atan 180 sub CorrAngle sub rotate } if + Symbol show + grestore + } + pathforall + z +} def +% +/OpenSymbolCurve { + OpenCurve + 0.1 setflat + /Shift Symbol stringwidth pop 2 div def + CurvePath +} def +% /AltCurve { { false NArray n 2 mul 2 roll [ n 2 mul 3 sub 1 roll ] aload @@ -392,6 +503,13 @@ tx@Dict begin n 4 lt { n { pop pop } repeat } { BAC /n n 4 sub def n { NAC } repeat EAC } ifelse } def % +/AltOpenSymbolCurve { + AltCurve + 0.1 setflat + /Shift Symbol stringwidth pop 2 div def + CurvePath +} def +% /ClosedCurve { NArray n 3 lt { n { pop pop } repeat } @@ -402,6 +520,13 @@ tx@Dict begin } ifelse } def % +/ClosedSymbolCurve { + ClosedCurve + 0.1 setflat + /Shift Symbol stringwidth pop 2 div def + CurvePath +} def +% /SQ { /r ED r r moveto r r neg L r neg r neg L r neg r L fill } def /ST { /y ED /x ED x y moveto x neg y L 0 x L fill } def /SP { /r ED gsave 0 r moveto 4 { 72 rotate 0 r L } repeat fill grestore } def @@ -469,6 +594,13 @@ tx@Dict begin 6 2 roll 4 2 roll ArrowB curveto } ifelse } def % +/OpenSymbolBezier { + OpenBezier + 0.1 setflat + /Shift Symbol stringwidth pop 2 div def + CurvePath +} def +% /ClosedBezier { BezierNArray n 1 eq @@ -478,6 +610,19 @@ tx@Dict begin closepath } ifelse } def % +/ClosedSymbolBezier { + /f ED % save showpoints value + 2 copy /yEnd ED /xEnd ED + counttomark -2 roll 2 copy /yStart ED /xStart ED + counttomark 2 roll + f + ClosedBezier + 0.1 setflat + /Shift Symbol stringwidth pop 2 div def + CurvePath + [ xEnd yEnd xStart yStart SymbolLine +} def +% /BezierShowPoints { gsave Points aload length 2 div cvi /n ED @@ -497,6 +642,21 @@ tx@Dict begin /Points [ x1 y1 x0 y0 x0 2 mul x1 sub y1 ] def } def % +/Parab1 { % 1 end | 0 SP + /ySP ED /xSP ED /y1 ED /x1 ED + /dx xSP x1 sub 3 div def + /dy ySP y1 sub 3 div def + newpath x1 y1 moveto xSP y1 lineto xSP ySP lineto + x1 ySP lineto closepath clip + currentpoint + newpath moveto + xSP dx sub ySP dy add x1 y1 ArrowA + xSP dx add ySP dy add xSP 2 mul x1 sub y1 ArrowB + curveto + /Points [ x1 y1 xSP ySP xSP 2 mul x1 sub y1 ] def +} def +% +% /Grid { newpath /a 4 string def @@ -737,6 +897,41 @@ dup angle0 sub dup abs 180 gt { 180 add 360 div floor 360 mul sub } { pop } ifel /IfVisible true def } def % +%%%%%%%%%%%%%%%%% tools %%%%%%%%%%%%%%%%%%%%%%%%% +%%%%% ### bubblesort ### +%% syntax : array bubblesort --> array2 trie par ordre croissant +%% code de Bill Casselman +%% http://www.math.ubc.ca/people/faculty/cass/graphics/text/www/ +/bubblesort { +4 dict begin + /a exch def + /n a length 1 sub def + n 0 gt { + % at this point only the n+1 items in the bottom of a remain to + % the sorted largest item in that blocks is to be moved up into + % position n + n { + 0 1 n 1 sub { + /i exch def + a i get a i 1 add get gt { + % if a[i] > a[i+1] swap a[i] and a[i+1] + a i 1 add + a i get + a i a i 1 add get + % set new a[i] = old a[i+1] + put + % set new a[i+1] = old a[i] + put + } if + } for + /n n 1 sub def + } repeat + } if + a +end +} def +% +% end %-----------------------------------------------------------------------------% % |