You are on page 1of 3

% Global scaling/translation 0.072 0.

072 scale 1 setlinecap % Purpose: draw simple line % Usage: x1 y1 x2 y2 t line /line { setlinewidth 4 2 roll moveto lineto stroke } bind def % Purpose: draw elliptical quadrant arc % Usage: cx cy xs ys xe ye a b q t % where cx,cy are centre of ellipse % a,b are ellipse diameter % xs,ys, xe,ye are start, end coords % q is quadrant number. % t is line width /quadrant { gsave setlinewidth /q exch def /b exch def /a exch def /ye exch currentlinewidth add def /xe exch currentlinewidth sub def /ys exch currentlinewidth sub def /xs exch currentlinewidth add def /cy exch def /cx exch def /ysf b a div def cx cy translate q 1 eq { /xs xs neg def /xe xe neg def } if q 2 eq { /xs xs neg def /ys ys neg def /xe xe neg def /ye ye neg def } if q 3 eq { /ys ys neg def /ye ye neg def } if newpath xe ys moveto xs ys lineto xs ye lineto xe ye lineto closepath clip newpath 1 ysf scale q 90 mul rotate a 0 moveto 0 0 a 0 90 arc stroke grestore } bind def % Purpose: draw bezier arc % Usage: x1 y1 ... x4, y4 t % xn yn are bezier points

% t is line width /bezier { setlinewidth moveto curveto stroke } bind def % Purpose: draw filled rectangle % Usage: x1 y1 x2 y2 fillbox /fillbox { /y2 exch def /x2 exch def /y1 exch def /x1 exch def x1 y1 moveto x2 y1 lineto x2 y2 lineto x1 y2 lineto closepath fill } bind def % Purpose: draw elliptical blob in colour c (0 black, 1 white) % Usage: x y a b c ellipse /eblob { /c exch def /b exch 2 div def /a exch 2 div def /y exch def /x exch def gsave 1 c sub setgray x y translate 1 b a div scale 0 0 a 0 360 arc fill grestore } bind def % Purpose: draw rectangular blob in colour c (0 black, 1 white) % Usage: x y a b c rectangle /rblob { /c exch def /b exch 2 div def /a exch 2 div def /y exch def /x exch def gsave 1 c sub setgray x a sub y b sub moveto x a add y b sub lineto x a add y b add lineto x a sub y b add lineto closepath fill grestore } bind def % Purpose: draw polygonal blob in colour c (0 black, 1 white)

% Usage: xn yn ... x1 y1 np c pblob /pblob { /c exch def /np exch def 1 c sub setgray moveto np 1 sub {lineto} repeat closepath fill } bind def % Purpose: draw track segment of specified thickness % Usage: x1 y1 x2 y2 t thickline /track { gsave 0 setlinecap setlinewidth 4 2 roll moveto lineto stroke grestore } bind def

You might also like