[comp.sys.mac.programmer] Offscreen pixmaps larger than screen

carrier@cogsci.ucsd.EDU (Mark Carrier) (05/03/89)

I've created an offscreen pixmap that is taller than one screen.  I can't
figure out how to draw into the entire pixmap.  When I try and fill the
entire offscreen pixmap with a single color, the painting gets clipped
to the upper screenful of the offscreen image.  I know that the offscreen
pixmap is created for the right size, but just can't draw into any
point whose vertical coordinate is greater than 480 (Apple color monitor).
I've followed almost exactly the code per TechNote 120 with modifications
on the size of the offscreen pixmap.  When I SetPort to my new graphics
port, thePort^.portRect is a rectangle as large as the screen, not as large
as my offscreen pixmap bounds!  Is this normal? 

Any help or speculation would be appreciated.


				Mark Carrier

trebor@biar.UUCP (Robert J Woodhead) (05/03/89)

In article <740@cogsci.ucsd.EDU> carrier@cogsci.UUCP (Mark Carrier) writes:
>I've created an offscreen pixmap that is taller than one screen.  I can't
>figure out how to draw into the entire pixmap.  When I try and fill the
>entire offscreen pixmap with a single color, the painting gets clipped
>to the upper screenful of the offscreen image.

Your problem is that your visRgn region is set to be the visRgn of the
original screen.  Remember that everything is clipped to the intersection
of portBits.bounds, portRect, the visRgn and the clipRgn; and that the
visRgn starts out as a handle to a rectangular region coincident with
screenBits.bounds, and clipRgn to a rect region -32767,-32767,32767,
32767.  Try this:

	setport(yourPort);		{ set to your port		}
	ClipRect(yourPort^.portRect);	{ set clipRgn to port size	}
	CopyRgn(yourPort^.clipRgn,yourPort^.visRgn);	{ fix visRgn	}

or, if you don't want to change the clip region for some reason:

	RectRgn(yourPort^.visRgn,yourPort^.portRect);

The first approach is preferable, especially if you are going to be
generating pictures; you want the clipRgn as small as possible or you
will have wierd problems when you copy the PICT into the clipboard and
paste it into something, because the PICT takes its "size" cue from the
clipRgn.

-- 
Robert J Woodhead, Biar Games, Inc.  !uunet!biar!trebor | trebor@biar.UUCP
"The lamb will lie down with the lion, but the lamb won't get much sleep."
     -- Woody Allen.