Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!iscuva!jimc From: jimc@iscuva.ISCS.COM (Jim Cathey) Newsgroups: comp.sys.mac.programmer Subject: Re: turning on a pixel Message-ID: <2599@iscuva.ISCS.COM> Date: 21 Aug 89 16:11:10 GMT References: <6294@hubcap.clemson.edu> Organization: ISC Systems Corporation, Spokane WA Lines: 35 In article <6294@hubcap.clemson.edu> mikeoro@hubcap.clemson.edu (Michael K O'Rourke) writes: >I am writing a graphics program that turns on many pixels one at a time >by calculating some mathematical eqns. (kind of a fractal). It presently >is using : > >moveto(x,y); >lineto(x,y); > >to turn on a pixel. Is there some quicker way to do this from pascal? >The program is horribly slow right now and it needs to be speeded up. For fast point plotting probably your best bet is to allocate an offscreen bitmap the size of the active area of the screen, and then set the bits in it yourself. When done (or periodically) just CopyBits this thing onto the real screen. The overhead of clipping tests and all of that really hurts the plotting of a single pixel. On your own array it's just a matter of *, shift and mask to find the bit to set. If you're really in a hurry you can pre-calculate a table of byte offsets based on Y value and skip the multiply. Using assembly means you can probably do it even faster. Doing it this way means you don't ever run afoul of bit depth on the screen, and you wont get whanged on the head if/when the video hardware ever gets protected, or is in some way strange on any particular machine. All it costs you is the array and a bit of skull sweat. +----------------+ ! II CCCCCC ! Jim Cathey ! II SSSSCC ! ISC-Bunker Ramo ! II CC ! TAF-C8; Spokane, WA 99220 ! IISSSS CC ! UUCP: uunet!iscuva!jimc (jimc@iscuva.iscs.com) ! II CCCCCC ! (509) 927-5757 +----------------+ "With excitement like this, who is needing enemas?"