Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!labrea!Portia!Jessica!rick From: rick@Jessica.stanford.edu (Rick Wong) Newsgroups: comp.sys.mac.programmer Subject: Re: Method to Define my own "strechable shapes" Message-ID: <1648@Portia.Stanford.EDU> Date: 18 Apr 89 17:21:16 GMT References: <820@garcon.cso.uiuc.edu> Sender: USENET News System Reply-To: rick@Jessica.stanford.edu (Rick Wong) Organization: Stanford University Lines: 43 In article <820@garcon.cso.uiuc.edu> emb90619@uxa.cso.uiuc.edu (Eric M Berdahl) writes: >I have a general shape stored in a RgnHandle. > >I want to be able to take this arbitrary shape and drag it out to >an arbitrary size (ala MacDraw). I have looked at MapRgn() and >InsetRgn() and neither routine gives me just what I'm looking for. >(Of course, I may just be doing them wrong.) If ANYONE can come >up with suggestions for how to implement this, I'd be eternally >grateful. QuickDraw pictures automatically perform scaling for you, so you could do the following to include your region in a picture: /* Save clipping */ aClipSave = NewRgn(); GetClip(aClipSave); aRect = (**myRgn).rgnBBox; ClipRect(&aRect); /* Make sure the picture's clipping is okay */ /*** The picture saves the port's pen attributes. Since I presume you are doing this for some sort of mouse-tracking, use xor mode. ***/ PenNormal(); PenMode(patXor); aPicHandle = OpenPicture(&aRect); FrameRgn(myRgn); /* Or PaintRgn() */ ClosePicture(); /* Restore clipping */ SetClip(aClipSave); DisposeRgn(aClipSave); Once you've got xor'ed region in a PicHandle, you can perform your mouse- tracking feedback by repeatedly calling DrawPicture. You could also make your feedback more user-friendly by drawing the region with its actual pen mode, then using offscreen drawing in your mouse- tracking loop (although, of course, this would be more work). Rick Wong Courseware Authoring Tools Project, Stanford University rick@jessica.stanford.edu