How do I keep a gsave/grestore protected fill object from flooding the clipping path meant to clip the object
I have defined a clipping path and then defined an object (closed path) to be filled protected within a gsave/grestore block. The clipping path should clip the object and leave the remaining object filled within a the unfilled background of the clipping path. But the result is the entire clipping path is filled. How do I stop this?
An example is:
/inch {72 mul } def
/triangle {gsave .9 setgray
0 inch 0 inch moveto
5 inch 0 inch lineto
2.5 inch 5 inch lineto
0 inch 0 inch lineto fill 0 setgray
0 inch 0 inch moveto
5 inch 0 inch lineto
2.5 inch 5 inch lineto
0 inch 0 inch lineto stroke
grestore} def
/SquarePath {newpath
1 inch 0 inch moveto
3 inch 0 inch lineto
3 inch 8 inch lineto
1 inch 8 inch lineto
1 inch 0 inch lineto closepath} def
% draw it
1 inch 1 inch translate
SquarePath clip
triangle
showpage
Any ideas? Thanks in advance
