wps

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

bowtie.wps (670B)


      1 % based on the JavaScript example from
      2 % https://developer.mozilla.org/en/drawing_graphics_with_canvas#section_6
      3 
      4 0 0 180 180 .gbox
      5 
      6 /bowtie { % fillStyle --
      7   200 200 200 0.3 .rgba .setFillStyle
      8   -30 -30 60 60 rectfill
      9   .setFillStyle 1.0 .setGlobalAlpha
     10   newpath
     11    25  25 moveto
     12   -25 -25 lineto
     13    25 -25 lineto
     14   -25  25 lineto
     15   closepath
     16   fill
     17 } bind def
     18 
     19 /bowtieDot { % --
     20   0 0 0 setrgbcolor
     21   -2 -2 4 4 rectfill
     22 } bind def
     23 
     24 /bowtie1 { % fillStyle angle x y --
     25   gsave
     26   translate
     27   rotate
     28   bowtie
     29   bowtieDot
     30   grestore
     31 } bind def
     32 
     33 45 45 translate
     34 (red)      0  0  0 bowtie1
     35 (green)   45 85  0 bowtie1
     36 (blue)   135  0 85 bowtie1
     37 (yellow)  90 85 85 bowtie1