[comp.sys.mac] fast plotting and screen saving

sdh@thumper.UUCP (01/27/87)

To answer the question on how to plot a single poinr
faster than  MoveTo(x,y) LineTo(x,y) with a pensize of 1,1:

consider what you want.  You want to set a single but on the
screen.  No sweat.  Here's a way to do it:

Create a bitmap that has 1 pixel in it.  It would need a 2 byte
bitmap, and a rectangle that's 1x1.  Use CopyBits to put it where you
want it to go.  You want the source rectangle to be the bitmap bounds,
the destination to be the x,y,x+1,y+1, the destination bitmap is the
thePort->portbits, and the clip region will probably be nil.

There is a more direct way.  You calculate the begining address of screen
memory and find the byte that you want to write into, and what bit needs to
be turned on.  This will probably be the optimal method, but you don't get
all the wonderful clipping.

If you want to save the bit image on the screen because you are putting
a window over (from a dialog box or some such), you should know what the
coordinates of the window to be drawn are, and you use CopyBits to copy
the image that will be covered up by that rectangle to an off screen
bitmap.  To refresh, do the reverse.

Steve "I've been away from Mac programming so this sounds sketchy" Hawley

(ucbvax, decvax)!bellcore!sdh