Article View: net.micro.mac
Article #1042Re: Calculating Region Areas
From: Larry Rosenstein
Date: Tue, 09 Apr 1985 17:37
Date: Tue, 09 Apr 1985 17:37
20 lines
1396 bytes
1396 bytes
A faster way to calculate the area of a region would be to create an
off-screen bitmap, do a FillRgn, and counting the 1 bits in the bitmap.
(Of course, you can optimize by checking for rectangular regions first.)
This requires only 1 regions operation, and you do not have to know the
region structure. Counting the bits should be very fast, and could even be
done in assembler. (My first thought would be to build a table that maps
the value of a byte into the number of 1 bits it contains, and iterate
through the bitmap a byte at a time.)
The only problem, is that you need to have enough memory for the off-screen
bitmap.
--
Larry Rosenstein
Apple Computer
UUCP: {nsc, dual, voder, ios}!apple!lsr
CSNET: lsr@Apple.CSNET
Technical Details
Message-ID:
<43652@apple.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!decwrl!sun!idi!apple!lsrReferences:
<ucbvax.6077>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1.chuqui 4/7/84; site apple.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!decwrl!sun!idi!apple!lsr From: lsr@apple.UUCP (Larry Rosenstein) Newsgroups: net.micro.mac Subject: Re: Calculating Region Areas Message-ID: <43652@apple.UUCP> Date: Tue, 9-Apr-85 12:37:03 EST Article-I.D.: apple.43652 Posted: Tue Apr 9 12:37:03 1985 Date-Received: Thu, 11-Apr-85 23:58:40 EST References: <ucbvax.6077> Reply-To: lsr@apple.UUCP (Larry Rosenstein) Distribution: net Organization: Macintosh Division, Apple Computer Lines: 20