Path: utzoo!attcan!uunet!cs.utexas.edu!usc!rutgers!sun-barr!sun!imagen!daemon From: geof@apolling (Geof Cooper) Newsgroups: comp.lang.postscript Subject: Re: setgray within the scope of a BuildChar Message-ID: <4254@imagen.UUCP> Date: 16 Aug 89 19:33:35 GMT Sender: daemon@imagen.UUCP Lines: 66 In article <2072@optilink.UUCP> cramer@optilink.UUCP (Clayton Cramer) writes: > I'm defining a character set, and I need to draw a reverse video circle. > > bsmiley { > newpath > 300 300 300 0 360 arc closepath fill > 300 300 150 210 330 arc 1 setgray 1 setlinecap 100 setlinewidth stroke > 200 400 70 0 360 arc closepath fill > 400 400 70 0 360 arc closepath fill } def You can achieve the effect you want to tracing the (multiple contour) outline of the object you want and then executing one FILL or EOFILL command. Either fill technique will work, but I find that EOFILL is easier to hand-design with, since you don't have to pay attention to the direction of contours. Recall that under EOFILL, you can tell whether a point is part of the region to be filled or not by counting if the number of contours around it is odd. Hence, a circle with a circle inside it turns into a ring-band. The principle inconvenience of doing this is that the ARC and ARCN operators make implicit use of the current point, so you have to compute the starting point of the arc manually and do a "moveto" to it before calling ARC. This "polar moveto" is an obvious primitive if you do a lot of stuff like this -- I just did the code out here. Here is my attempt: /bsimley { % outer circle newpath 300 300 300 0 360 arc closepath % This part would make it a non-reversed smiley %600 300 moveto %300 300 280 0 360 arc closepath % mouth: Can make this more efficient by pre-computing % the trig computations. % Upper lip 300 175 210 cos mul add 350 175 210 sin mul add moveto 300 350 175 210 330 arc % right corner - draw 180-degree arc between upper & lower lips. currentpoint exch 37.5 330 cos mul add exch 37.5 330 sin mul add 37.5 150 330 arcn % lower lip = same arc 75 units down, going the other way. 300 350 250 330 210 arcn % left corner currentpoint exch 37.5 210 cos mul sub exch 37.5 210 sin mul sub 37.5 210 30 arcn closepath % 270 = 200 + 70*cos(0), 400 = 400 + 70*sin(0). 270 400 moveto 200 400 70 0 360 arc closepath 470 400 moveto 400 400 70 0 360 arc closepath eofill } bind def