Path: utzoo!attcan!uunet!amdahl!ames!pasteur!agate!bionet!csd4.milw.wisc.edu!dogie!yahnke@vms.macc.wisc.edu From: yahnke@vms.macc.wisc.edu (Ross Yahnke, MACC) Newsgroups: comp.sys.mac.programmer Subject: Re: Drawing Points Fast ?? Message-ID: <1297@dogie.edu> Date: 10 Mar 89 14:44:23 GMT Sender: news@dogie.edu Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 30 In article <2068@helios.ee.lbl.gov>, osborn@ux1.lbl.gov (James R Osborn) writes... >Would > >BitSet(bytePtr, numBit) and BitClr(bytePtr, numBit) > >be faster than using MoveTo(h, v) with Line(0, 0)? I guess you would Short of writing assembler, isn't the following even faster than BitSet & BitClr? byte *bmOrg; /* ptr to start of bitmap image */ int bmRB; /* rowBytes of bitmap image */ byte *bytePtr; /* equivalent to: BitClr(bmOrg + (bmRB * y), x); */ bytePtr = bmOrg + (bmRB * y) + (x >> 3); *bytePtr &= ~(1 << (7 - (x & 7))); /* equivalent to: BitSet(bmOrg + (bmRB * y), x); */ bytePtr = bmOrg + (bmRB * y) + (x >> 3); *bytePtr |= (1 << (7 - (x & 7))); (all assuming offscreen bitmaps, your own range checking and copybits to onscreen window, of course) //////////////////////////////////////////////////////////// Internet: yahnke@vms.macc.wisc.edu Bitnet: yahnke@wiscmacc(.bitnet) \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\