[comp.sys.apple2] GrafPorts

gt0t+@andrew.cmu.edu (Gregory Ross Thompson) (10/31/90)

  This is to all you toolbox gurus out there:

  I'm working on doing some quickdraw stuff from C.  I need to a few
things with GrafPorts.  First, I save the current one so I can re-set
it at the end of this whole thing.  I do this with:

oldport=GetPort();

  My guess is that it's working fine.  I don't see why not.  The
problem arises when I need to open my own port.  I'd use:

Open Port(myportptr);

  But toolbox 2 is really vague.  It says things like:

"Normally, you don't call OpenPort yourself--in most cases, your
application will draw into a window you've created with Window Manager
routines, and these routines call OpenPort to create the window's
GrafPort."

  So the toolbox ref doesn't say much about opening your own
grafports.  Do I have to allocate some memory and send a handle to
quickdraw, or what?  Is there any way I can tell it to open up a new
GrafPort just like the old one?  Should I just do:

oldport=GetPort();
{all of my code}
SetPort(oldport);

  to restore the original port?  Should I open up a completely new
port?  I'm so confused...

  Please respond via mail so as not to clog the net.

		-Greg T.
		 gt0t+@andrew.cmu.edu