Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!cornell!batcomputer!pyramid!voder!apple!lsr From: lsr@apple.UUCP (Larry Rosenstein) Newsgroups: comp.sys.mac Subject: Re: Drawpicture from C - HELP!! Message-ID: <6455@apple.UUCP> Date: Mon, 12-Oct-87 13:09:57 EDT Article-I.D.: apple.6455 Posted: Mon Oct 12 13:09:57 1987 Date-Received: Wed, 14-Oct-87 00:46:31 EDT References: <773@sdcc18.ucsd.EDU> Reply-To: lsr@apple.UUCP (Larry Rosenstein) Organization: Advanced Technology Group, Apple Computer Lines: 33 Keywords: Am I doing it wrong?!? In article <773@sdcc18.ucsd.EDU> cs161aey@sdcc18.ucsd.EDU (Joe Gervais) writes: > > I'm programing in Megmax C (v. 2.0 (?)) and after defining a picture >and closing it, I can draw it in the original srcrect but if I try to move >it I don't get anything. I "believe" I'm doing it correctly, but I just >don't get anything. Even just offsetting the srcrect (so as not to change >size and need scaling) it doesn't work. This is a common problem with using pictures. When you open a picture, Quickdraw records the current state ofthe clipping region in the picture. When you draw a picture in a rectangle that is offset from its creation rectangle, Quickdraw offsets the region as well. The problem occurs because the default clipping in a new grafPort is the largest possible rectangle. Offsetting this rectangle by any amount causes the coordinates to overflow, thus creating an empty region. The empty clipping region prevents anything from being drawn. The solution is to always set the clipping before or right after calling OpenPicture. The general rule of thumb is to call ClipRect with the same rectangle passed to OpenPicture. -- Larry Rosenstein Object Specialist Apple Computer AppleLink: Rosenstein1 UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr CSNET: lsr@Apple.com