Annotation of Examples/AppKit/Draw/drawWraps.psw, revision 1.1.1.1

1.1       root        1: #import <string.h>
                      2: 
                      3: defineps PSInit()
                      4: 
                      5: /oval {
                      6: % w h x y
                      7:     translate scale newpath .5 .5 .5 0 360 arc closepath
                      8: } def
                      9: 
                     10: /line {
                     11: % w h x y
                     12:     moveto rlineto stroke
                     13: } def
                     14: 
                     15: /setup {
                     16: % linejoin lincap linewidth
                     17:     setlinewidth
                     18:     setlinecap
                     19:     setlinejoin
                     20:     gsave
                     21: } def
                     22: 
                     23: /arrow {
                     24: % angle x y
                     25:     newpath
                     26:     moveto
                     27:     dup rotate
                     28:     -13 6 rlineto
                     29:     4 -6 rlineto
                     30:     -4 -6 rlineto
                     31:     closepath
                     32:     gsave
                     33:     0 setlinejoin
                     34:     stroke
                     35:     grestore
                     36:     fill
                     37:     neg rotate
                     38: } def
                     39: 
                     40: endps
                     41: 
                     42: /*
                     43:  * The following proc has an interesting feature.  Since we draw an oval by
                     44:  * drawing a unit circle, then scaling it in both directions, we run into the
                     45:  * problem that the linewidth also gets scaled!  We avoid this by reverting
                     46:  * to the device matrix (the non-scaled matrix) just before stroking the line.
                     47:  * This works because the path is built up with the scaled matrix, but the
                     48:  * stroke is done with the unscaled one.  Neat, huh?
                     49:  */
                     50: 
                     51: defineps PSFramedOval(float x, y, w, h)
                     52:     w h x y oval
                     53:     matrix defaultmatrix setmatrix stroke
                     54: endps
                     55: 
                     56: defineps PSFilledOval(float x, y, w, h)
                     57:     w h x y oval fill
                     58: endps
                     59: 
                     60: defineps PSLine(float x, y, w, h)
                     61:     w h x y line
                     62: endps
                     63: 
                     64: defineps PSCurve(float x0, y0, x1, y1, x2, y2, x3, y3)
                     65:     x0 y0 moveto x1 y1 x2 y2 x3 y3 curveto stroke
                     66: endps
                     67: 
                     68: defineps PSArrow(float x, y, angle)
                     69:     angle x y arrow
                     70: endps
                     71: 
                     72: defineps PSSetParameters(int cap, join; float linewidth)
                     73:     join cap linewidth setup
                     74: endps

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.