[comp.windows.news] Canvases and Graphics State

peterson@cleo.SW.MCC.COM (James Peterson) (02/26/88)

I am trying to create a system with many canvases.  Associated with
each canvas is a transformation matrix that defines the coordinate
space for that canvas.  The transformation matrix, of course, is a
part of the graphics state. The PostScript Reference Manual (Red Book)
lists, on pages 59-60, the contents of a graphics state.  I cannot
find any statement of what a graphics state in NeWS consists of. I
want to be able to set a canvas and then modify the coordinate space
for that canvas.

Experimentally, I find that if I save the current graphics state
(using currentstate), then set the canvas (using setcanvas), then
restore the graphics state (using setstate) that the current canvas is
changed.  So it appears that the current canvas is a part of the
graphics state.  Is this so?

If the canvas is a part of the graphics state, then it would seem that
I need to first set the graphics state (using setstate) and then the
canvas (using setcanvas).  But the explanation of setcanvas, on page
132 of the NeWS manual, says it "implicitly executes newpath
initmatrix".  Newpath will destroy the path of the graphics state and
initmatrix destroys the transformation matrix.  Thus it appears
impossible to set both the graphics state and the canvas.

A further problem then is the meaning of initmatrix: the Red book says
that initmatrix sets the transformation matrix to the "default
matrix for the current output device".  What is the default matrix of
the current output device for a canvas?  There is no index item in the
NeWS manual for default or matrix or initmatrix or output.  The
explanation of reshapecanvas on page 131 hints at a default matrix,
but says that if the canvas is the same as the current canvas, it does
an initmatrix which would seem to be a circular definition if the
default matrix is being set by reshapecanvas which does an initmatrix
which uses the default matrix.

In Summary, a brief list of my questions is:

(a) What is the complete definition of the NeWS graphics state?  

(b) Is a canvas an element of the graphics state?

(c) Given an arbitrary canvas object (A) and an arbitrary graphics
state (B), how do I set the current canvas to A and the graphics state 
(specifically the transformation matrix) to B?

(d) What is the effect of the implicit initmatrix for the setcanvas
and reshapecanvas commands?

I tried to ask Sun Technical support these questions, and all I got was
"good questions".

jim
-- 
James Peterson
james.peterson@mcc.com  or  ...sally!im4u!milano!peterson