[comp.lang.postscript] Clipping path not being followed

prs@tcsc3b2.tcsc.com (Paul Stath) (02/07/91)

	I seem to have a problem with the 'clip' operator.

	The path I am clipping doesn't seem to affect later marks placed
	on the page using the 'arc' operator.  If any of you PostScript
	gurus have an idea why this doesn't work, please enlighten me.

	If it is a bug in our PostScript Interp, please advise me on a
	fix that will work instead.

	The image is supposed to be a cross shaped object with a pair
	of rings suspended above it.  The idea is to make the rings
	look like they are shadows, thus the clipping operation to remove
	the edges of the rings that don't fit on the cross shape.

	To debug this, I have used the 'clippath' operator to make the
	current path the same as the clipping area.  I then filled it
	with black to see exactly the area I was clipping.

	No matter what I do, the rings are not clipped!  This is driving
	me crazy.  I might be a problem with the interpreter, so please
	run it through YOUR laser, and tell me what comes out.

	Thanks.


--------Code follows------------Code follows------------Code follows------------
%!
/#copies 1 def

%% landScape:  Rotates the page to landscape mode
/LandScape {
	630 0 translate 90 rotate
} def

% Draw cross
/Cross {
	0		2 72 mul	rlineto
	1 72 mul neg	0		rlineto
	0		1 72 mul	rlineto
	1 72 mul	0		rlineto
	0		1 72 mul	rlineto
	1 72 mul	0		rlineto
	0		1 72 mul neg	rlineto
	1 72 mul	0		rlineto
	0		1 72 mul neg	rlineto
	1 72 mul neg	0		rlineto
	0		3 72 mul neg	rlineto
	1 72 mul neg	0		rlineto
	closepath
} def

LandScape	% Turn paper to Landscape position

0.8 0.8 scale

% Draw cross shadow
7 90 mul	4.5 90 mul	moveto
11.25 		11.25 neg	rmoveto
gsave Cross gsave 0 setgray fill grestore newpath grestore

% Draw cross
7 90 mul	4.5 90 mul	moveto
gsave Cross gsave 1 setgray fill grestore stroke grestore

% Draw circle shadows
gsave
7 90 mul	4.5 90 mul	moveto
Cross clip newpath

7 90 mul	4.5 90 mul	moveto
36.25	180		rmoveto
11.25	11.25 neg	rmoveto

0.45 90 mul	% Ring radius
/Rad 0.45 90 mul def
currentpoint	% save current point on stack
	0.25 Rad mul Rad sub 0 rmoveto	% Move to center of circle
	currentpoint			% save center of circle on stack
	Rad 0 rmoveto			% Move to edge of circle
	Rad 0 360 arc			% Draw circle
	currentlinewidth dup 2.5 mul setlinewidth stroke
	setlinewidth gsave 1 setgray stroke grestore
moveto		% return to point saved on stack
currentpoint	% draw second circle over first
	0.75 Rad mul 0 rmoveto
	currentpoint
	Rad 0 rmoveto
	Rad 0 360 arc
	currentlinewidth dup 2.5 mul setlinewidth stroke
	setlinewidth gsave 1 setgray stroke grestore
moveto
% Now interlock the first ring with the second ring
0.25 Rad mul Rad sub 0 rmoveto
currentpoint
0 Rad neg rmoveto
Rad 270 360 arc
	currentlinewidth dup 2.5 mul setlinewidth stroke
	setlinewidth gsave 1 setgray stroke grestore
clippath stroke
grestore

showpage