fonion@oracle.com (Fritz Onion) (03/16/91)
I'm writing a game using offscreen bitmaps and need to copybits() objects from one bitmap to another with a mask region so the whole rectangle isn't copied. My problem is, how do I define a mask region that will exactly surround my objects? IM-1 describes how to create a region using quickdraw routines, but that would take forever. I've heard of games using pre-drawn regions stored in PICTS, but it's not clear to me how to get the region information from the PICT to the region. IM-1 simply says that non-rectangular region information is stored in some optimized way, but doesn't specify exactly what that way is. Can anyone tell me the best way to specify these regions? Either direct email or a post in comp.sys.mac.programmer would be fine. Thanks in advance - -Fritz Onion <fonion@oracle.com> -- ------------------------------------------------------------------------------- Fritz Onion Oracle Corporation Applications Developer 2929 Campus Drive Application Foundation Suite 240 (415) 578-6811 San Mateo, CA 94403
2fmlcalls@kuhub.cc.ukans.edu (03/17/91)
In article <FONION.91Mar15160130@ap4seq.oracle.com>, fonion@oracle.com (Fritz Onion) writes: > I'm writing a game using offscreen bitmaps and need to > copybits() objects from one bitmap to another with a mask region so > the whole rectangle isn't copied. My problem is, how do I define a > mask region that will exactly surround my objects? IM-1 describes how It almost sounds as though you want CopyMask instead of CopyBits. Do you need the region for global clipping or just around the small object you're copybitting? To use CopyMask, just create a black PICT for every object PICT you have, filling in only the 'region' you want transferred. Wher ever there is a black pixel in the mask, CopyMask will transfer the corresponding pixel from your source bitmap. > to create a region using quickdraw routines, but that would take > forever. I've heard of games using pre-drawn regions stored in PICTS, > but it's not clear to me how to get the region information from the I've always used the more tedious method of theRgn:=NewRgn, OpenRegion(theRgn), MoveTo, LineTo, etc..... It's tedious like a say, but a scrap of paper and a DA like Coordinates or Microscope can read out the coordinates for you. > PICT to the region. IM-1 simply says that non-rectangular region > information is stored in some optimized way, but doesn't specify > exactly what that way is. Can anyone tell me the best way to specify > these regions? > Either direct email or a post in comp.sys.mac.programmer would > be fine. Thanks in advance - > -Fritz Onion > <fonion@oracle.com> You could also create your own REGN resource type for storing all these coordinates. Duane Blehm did this in his games. If you send away for the source code, it even comes with a region builder utility for extracting regions from a PICT (yes, Duane's parents are handling source code orders and shareware). john calhoun