john@trigraph.UUCP (John Chew) (03/28/89)
Here's yet another offscreen bitmap question. It all started out when I had to write a program that would take AppleScan-generated files and convert them to some arbitrary bitmap format for use in another environment. All I wanted was the dimensions of the scanned image, and a stream of hex representing the bitmap. The images were all to be 100 dpi and one bit deep. I *could* have used TIFF files but I thought that PICT files would be easier to decode, and besides, the people who wrote AppleScan must have thought so since they didn't make any provision for reading TIFF files back into AppleScan for touching up. So the basic strategy was to read the MacDraw header to get the resolution and bounding box, then spool the rest of the file (the PICT2) into an offscreen pixmap and extract the data starting at baseAddr. The problem is that doing simply this results in a 72% scaled bitmap, as CQD is clever enough to recognize that the pixmaps in the PICT2 are 100 dpi and therefore need to be adjusted to maintain the same dimensions on what is presumably a 72 dpi offscreen pixmap. I have not been able to think of a simple way of creating a colour grafport with an offscreen pixmap that is one bit deep regardless of the current screen depth, and whose resolution is arbitrary and may not match the current screen. Can you? [ I eventually patched the bitsProc bottleneck procedure to fudge the arguments CopyBits() was being passed, but this is just too ugly for words. ] John -- john j. chew, iii phone: +1 416 425 3818 AppleLink: CDA0329 trigraph, inc., toronto, canada {uunet!utai!utcsri,utgpu,utzoo}!trigraph!john dept. of math., u. of toronto poslfit@{utorgpu.bitnet,gpu.utcs.utoronto.ca}