[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to convert from PICT to RGN for bounding region clicks



Excerpts from internet.listserv.info-mcl: 15-Mar-94 How to convert from
PICT to.. by MATTHEW CORNELL@cs.umass 
> We want to use arbitrary regions to identify portions of a picture for
> use as "hot spots" when the user clicks. We have a PICT but all that
> gives us is the bounding rectangle. What we need is a REGION that
> defines the PICT's outline. Is there a QuickDraw trap to do this? We
> tried opening a region, drawing the pict, then closing the region, but
> that failed because regions don't record picture drawing.
> 
> matt

Some solutions:

1) What Bill suggested would be fairly difficult because if your pict is
not just one color, you would have to pass a pascal search proc to
CalcCMask.  I don't even know if this is possible without compiling the
search proc under MPW and whatnot.

2) If the outline of your pict will map to white (or is it black?), then
you could bypass the call to CalcCMask by whipping up an offscreen
buffer of bit depth 1 (i.e., a bitmap), draw your PICT into it, and then
call BitmapToRegion on the bitmap to get the resultant region.

2) It sounds like you might want to use a CICN instead of a PICT.  CICNs
have an associated mask region that is easy to create in your favorite
resource editor from the CICN via drag and drop.  If the PICT is
composed of mostly pixmaps anyway, then this is probably the most sane
option.  If, on the other hand, your PICT is more similar to an
Encapsulated PostScript file, you may want to consider 2 or 1 (with a
matchproc).

Blaine.