wps

PostScript for the Web
git clone https://logand.com/git/wps.git/
Log | Files | Refs | LICENSE

commit ff872314c1b478b69cd65583bc4d25099225231d
parent 4e4a714f8e1ba6abc04764292934231706540bba
Author: tomas <tomas@logand.com>
Date:   Sat, 23 Jan 2010 14:44:17 +0100

examples updated

Diffstat:
Mbowtie.wps | 2+-
Mclock2.wps | 13++++++++-----
Mfill.wps | 17+++++++++++------
Mheart.wps | 2++
Mrect.wps | 2+-
Msmile.wps | 4++--
Msquares.wps | 6++----
Msquares2.wps | 2++
Mstar.wps | 3+++
Mtriangles.wps | 2++
10 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/bowtie.wps b/bowtie.wps @@ -24,7 +24,7 @@ /bowtie1 { % fillStyle angle x y -- gsave translate - .deg2rad rotate + rotate bowtie bowtieDot grestore diff --git a/clock2.wps b/clock2.wps @@ -1,6 +1,9 @@ % based on the PostScript example from % http://oreilly.com/openbook/cgi/ch06_02.html +0 0 150 150 .gbox +1 0 0 -1 0 150 cm + /max 150 def /width 1.5 def /marker 5 def @@ -17,9 +20,9 @@ /blue {0 0 1 setrgbcolor} def /black {0 0 0 setrgbcolor} def -/hangle {$h 12 div .pi 2 mul mul neg} def % TODO smooth motion -/mangle {$m 60 div .pi 2 mul mul neg} def -/sangle {$s 60 div .pi 2 mul mul neg} def +/hangle {$h 12 div 360 mul neg .deg2rad} def % TODO smooth motion +/mangle {$m 60 div 360 mul neg .deg2rad} def +/sangle {$s 60 div 360 mul neg .deg2rad} def /hand { % segment angle color width -- origin moveto @@ -38,12 +41,12 @@ width setlinewidth black clippath fill % background center dup translate - 90 .deg2rad rotate + 90 rotate gsave % markers 12 { radius marker sub 0 moveto marker 0 rlineto red stroke - .pi 6 div rotate + 360 12 div rotate } repeat grestore newpath origin radius 0 360 arc blue stroke % circle diff --git a/fill.wps b/fill.wps @@ -1,15 +1,20 @@ % based on the JavaScript example from % https://developer.mozilla.org/samples/canvas-tutorial/4_1_canvas_fillstyle.html +/n 5 def +/w 25 def + +0 0 n w mul dup .gbox + 4 dict begin - 0 1 5 { + 0 1 n { /i exch def - /ii 255 255 5 div i mul sub def - 0 1 5 { + /ii 1 1 n div i mul sub def + 0 1 n { /j exch def - /jj 255 255 5 div j mul sub def - ii jj 0 .rgb .setFillStyle - 25 j mul 25 i mul 25 25 rectfill + /jj 1 1 n div j mul sub def + ii jj 0 setrgbcolor + w j mul w i mul w w rectfill } for } for end diff --git a/heart.wps b/heart.wps @@ -1,6 +1,8 @@ % based on the JavaScript example from % https://developer.mozilla.org/samples/canvas-tutorial/2_6_canvas_beziercurveto.html +0 0 150 150 .gbox + q 75 40 m 75 37 70 25 50 25 c diff --git a/rect.wps b/rect.wps @@ -5,5 +5,5 @@ 72 0 l 0 -72 l -72 0 l -4 setlinewidth +4 w h S diff --git a/smile.wps b/smile.wps @@ -3,12 +3,12 @@ 0 0 150 150 .gbox -%0 0 m +%0 0 m % TODO m op meaning? newpath 75 75 50 0 360 arc S 110 75 m -75 75 35 0 180 arc +75 75 35 0 180 arcn S 65 65 m 60 65 5 0 360 arc diff --git a/squares.wps b/squares.wps @@ -1,7 +1,5 @@ -%%% -*- ps -*- -%%% -%%% based on the JavaScript example from -%%% https://developer.mozilla.org/samples/canvas-tutorial/5_1_canvas_savestate.html +% based on the JavaScript example from +% https://developer.mozilla.org/samples/canvas-tutorial/5_1_canvas_savestate.html q 0 0 m 0 0 150 150 re f diff --git a/squares2.wps b/squares2.wps @@ -1,6 +1,8 @@ % based on the JavaScript example from % https://developer.mozilla.org/en/drawing_graphics_with_canvas +0 0 100 100 .gbox + q 0.8 0 0 rg 0 0 m diff --git a/star.wps b/star.wps @@ -1,6 +1,9 @@ % based on the PDF example from % http://www.adobe.com/technology/pdfs/presentations/KingPDFTutorial.pdf +0 0 100 100 .gbox +1 0 0 -1 0 100 cm + q 0 0 1 rg 4 0 0 4 50 50 cm diff --git a/triangles.wps b/triangles.wps @@ -1,6 +1,8 @@ % based on the PDF example from % https://developer.mozilla.org/samples/canvas-tutorial/2_3_canvas_lineto.html +0 0 150 150 .gbox + 25 25 m 105 25 l 25 105 l