/dospiral { % - => - (draw a spiral from line segments) gsave % save graphics context clippath pathbbox % cliche, stack == x y w h pop pop % remove w,h translate % translate origin to x,y clippath pathbbox % x y w h 2 div exch % x y h/2 w 2 div exch % x y w/2 h/2 1 index 1 index % x y w/2 h/2 w/2 h/2 translate % move origin to w/2, h/2 89 rotate % x y w/2 h/2 min % puts min of h/2 w/2 on stack dup % dup top value scale % scale to dup'ed values .85 .85 scale 25 { % draw 25 segments newpath 0 .9 moveto 0 0 1 90 -90 arc 0 0 .9 -90 90 arcn fill % fill segment .88 .88 scale 22.5 rotate } repeat pop pop % clear stack grestore % restore graphics context } def /makewin { % - => - (builds a test window) /win framebuffer /new DefaultWindow send def % cliche { /PaintClient { % damage calls % /PaintClient dospiral % draw the spiral } def /FrameLabel ( Workspace ) def % label the window /PaintIcon { % define icon image erasepage % clear the canvas dospiral % call /PaintClient 0 strokecanvas % stroke canvas border } def } win send % send to window /reshapefromuser win send % size it /map win send % make it visible } def makewin % run the program