lewak@sdcsvax.UUCP (George Lewak) (10/20/85)
Has anybody out there figured out, or found documented, the internal format of regions on the MacIntosh? I would appreciate anything that anyone can tell me. Victor Romano
steve@anasazi.UUCP (Steve Villee) (10/25/85)
> > > Has anybody out there figured out, or found documented, the internal > format of regions on the MacIntosh? I would appreciate anything that > anyone can tell me. > > Victor Romano Yes, I have found the format through examination of a ROM disassembly. I wrote an article for MacTutor explaining this format in some detail, and also describing the algorithms QuickDraw uses to combine regions (such as UnionRgn, SectRgn). I submitted the article in July, and the first comments from Dave Smith were something to the effect that it was "too esoteric". I submitted a revised article in September that also included a routine to calculate the area of a region, as an example of an application. Last I heard from Dave, it might show up in the November issue. If not, maybe I'll just post the article to net.sources.mac. Briefly, the representation of a non-rectangular region contains a list of the region's "corner points" (my terminology). A coordinate point is considered a corner point of the region if and only if exactly 1 or 3 of the four adjacent graphic points (that are mapped to bits) are in the region. I call them corner points because in the case of rectangular regions, they are just the corners in the usual sense. The list of corner points in the representation is organized into rows. The rows are sorted by increasing vertical coordinate. Each row contains the common vertical coordinate, followed by the horizontal coordinates in increasing order, terminated by a 32767. The list of rows itself is terminated by a 32767 also, although you can find the end by looking at the size field at the front. One problem with this representation is that if one of the corner points has either a vertical or a horizontal coordinate of 32767, then QuickDraw gets messed up. Hope this helps. --- Steve Villee (ihnp4!terak!anasazi!steve) International Anasazi, Inc. 7500 North Dreamy Draw Drive, Suite 120 Phoenix, Arizona 85020 (602) 870-3330