[comp.windows.news] currentpath / setpath

mike@pixar.UUCP (Mike Russell) (09/14/88)

There have been several questions recently (from zwicky and others) re the
currentpath and setpath operators.  These operators allow the current path
to be saved and used later.

I was particularly interested in saving these paths and rapidly re-displaying
them with different clipping, scaling, and rotation.

After following several leads, I've given up on that particular problem,
and will simply use imagecanvas to do the transform.

As zwicky (sorry I lost your real name)  guessed, currentpath and setpath
save and restore a path that is suitable for filling, but not stroking.
The path may not be scaled or rotated, however I think translation may be
faked via a transparent canvas.

Here's a snippet of code that saves two paths and plays with them.

	0 0 moveto 10 0 lineto 10 10 lineto 0 10 lineto closepath 
	/a currentpath def
	newpath     
	100 100 moveto 110 100 lineto 110 110 lineto 100 110 lineto closepath
	/b currentpath def
	a setpath 0 setgray fill
	b setpath fill          
	1 setgray
	a setpath fill
	b setpath fill

I'm curious if anyone else has found further functionality in currentpath
and setpath.
-- 
Mike Russell ucbvax!pixar!mike	Trust in Allah, but
				tie your camel first.