Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!amdahl!pyramid!voder!apple!lsr
From: lsr@Apple.COM (Larry Rosenstein)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Offseting a picture with DrawPicture
Keywords: DrawPicture problem clipping PICT
Message-ID: <13102@apple.Apple.COM>
Date: 30 Jun 88 18:11:48 GMT
References: <1578@microsoft.UUCP>
Reply-To: lsr@apple.apple.com.UUCP (Larry Rosenstein)
Organization: Advanced Technology Group, Apple Computer
Lines: 38

In article <1578@microsoft.UUCP> t-benw@forward.UUCP (Benjamin Waldman) writes:
>
>using DrawPicture to draw the picture in the new rect.  The problem is that
>nothing is printing out.
>
>He's drawing to a printer, and is using ClipRect before the DrawPicture
>to set the clipping region to the entire page (rPage).  Does the picture
>have info about its own clipping region that is conflicting with the new
>one?

The answer to the last question is yes, and that's the problem.  

When you call OpenPicture and start drawing, Quickdraw records the current
clipping region in the picture.  A newly-created port has a clipping region
that is the largest possible rectangle.  The problem is that if you offset a
picture when drawing, then this clipping region must be offset too.  In this
case, however, the coordinates overflow leaving you with an empty clipping
region.

When creating a picture, one should always set the clipping to the minimum
necessary (usually the same as the rectangle passed to OpenPicture).

It might be possible to fix the problem by duplicating the picture and
changing the clipping:

	r := pic^^.picFrame;
	ClipRect(r);
	newPic := OpenPicture(r);
	DrawPicture(pic, r);
	ClosePicture;

In theory, newPic should be the same as pic, except with the proper clipping
region set.  I haven't tried this to see if it works, however.

		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 27-AJ  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr