emb90619@uxa.cso.uiuc.edu (Eric M Berdahl) (04/18/89)
Here's my problem: I have a general shape stored in a RgnHandle. For instance, it could be a donut shape originally created by dragging out two concentric circles and defining the area between them as the region, but I really don't know anything about the nature of the region. 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 gratefull. Thanx in advance. -Eric Eric M. Berdahl PsiWare Software not inc. emb90619@uxa.cso.uiuc.edu
beard@ux1.lbl.gov (Patrick C Beard) (04/18/89)
In article <820@garcon.cso.uiuc.edu> emb90619@uxa.cso.uiuc.edu (Eric M Berdahl) writes: >Here's my problem: >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.) ... >-Eric You probably are using InsetRgn incorrectly. If you pass negative values for dh and dv, you will grow the region. If you have different values for dh and dv, you can grow in a non-uniform way, just like the grow handles in MacDraw. __________________ Patrick Beard PCBeard@lbl.gov BSI, Berkeley, CA ___________________
rick@Jessica.stanford.edu (Rick Wong) (04/19/89)
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