Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!apple!well!oster From: oster@well.sf.ca.us (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: Quick drawing Message-ID: <22212@well.sf.ca.us> Date: 17 Dec 90 07:30:43 GMT References: Lines: 32 In article aberno@questor.wimsey.bc.ca (Anthony Berno) writes: >This, of course, involves drawing LOTS of little color rectangles on the >screen. When drawing a little 2x2 rectangle, there are many ways of >doing it. You can use FrameRect, PaintRect, use a pen, etc. But what is >the fastest? The fastest way is to 1.) Use an offscreen pixmap with the same longword alignment as the destination window. The new offscreen support from Apple may help here. 2.) make sure the offscreen pixmap has the same color table as the destination window. 3.) Draw all your 2x2 rectangles with 4 assignment statements. (if you align things right, you can draw a 2x2 rectangle in 2 16-bit assignment statements. Can't get much faster than that.) 4.) when they arer all drawn, CopyBits the entire offscreen pixmap to the destination window. This gives you the benefits of QuickDraw to handle video in other address spaces, and clipping against partially obscrured windows, but you pay for the overhead only once. >Also, although this may sound kind of silly, I CANNOT figure out from >Inside Macintosh how to do something very simple - take a portion of >the image in a color window and save it to disk as a color PICT file. There was a tecch note about this. First, get a PicHandle. OpenPicture(); CopyBits() ClosePicture() is the basic idea here. Then you can either do a PutScrap() to put the picHandle on the clipboard, or you can write it to a file of type PICT after a header of 512? bytes of zero. -- -- David Phillip Oster - At least the government doesn't make death worse. -- oster@well.sf.ca.us = {backbone}!well!oster