brownrigg@kuhub.cc.ukans.edu (02/08/90)
Can someone describe for me how to create a PICT file consisting of only a bitMap? I have some seismic data that comes in as a bitmap (in the non-Mac sense), just simple 1-bit/pixel stuff. I've tried to grok the details from Inside Mac but I'm apparently missing something 'cause all off my paint tools fail. Any general tips to get me pointed in the right direction would be gratefully appreciated. Thanks Rick Brownrigg Kansas Geological Survey Univ. of Ks Disclaimer: Any views expressed above are necessarily those of my employer - but they should be.
rcfische@polyslo.CalPoly.EDU (Raymond C. Fischer) (02/08/90)
In article <22163.25d040f6@kuhub.cc.ukans.edu> brownrigg@kuhub.cc.ukans.edu writes: >Can someone describe for me how to create a PICT file consisting of only >a bitMap? This is from memory, so check the calls against Inside Mac. Assuming the existence of a GrafPort that has your BitMap in it ... SetPort (your GrafPtr); OpenPicture CopyBits (thePort^.portBits, thePort^.portBits, thePort^.portRect, thePort^.portRect, srcCopy, NIL); ClosePicture This will create a PICT that has nothing but the bitmap in it. To turn this into a PICT file, create a file of type PICT, write 512 bytes of zeros, then write entire handle contents returned from the OpenPicture/ClosePicture. Make sure that at some time after opening the port and BEFORE calling OpenPicture, you set the ClipRgn of the port. One way to do this is ClipRect (thePort^.portRect); If you have only a BitMap and no GrafPort, then open a GrafPort, set the portBits to the bitmap record (using SetPortBits?), set the portRect (as in: thePort^.portRect := thePort^.portBits.bounds), and set the ClipRgn. The do the above CopyBits and then close the port; If the GrafPort is a CGrafPort, this will produce a type 2 PICT (color) which won't work with any Mac that doesn't have color quickdraw. Of course, GrafPort is synonymous with WindowRecord in this example. Any questions? Ray Fischer rcfische@polyslo.calpoly.edu