Path: utzoo!attcan!uunet!lll-winken!uwm.edu!bionet!ucselx.sdsu.edu!polyslo!rcfische From: rcfische@polyslo.CalPoly.EDU (Raymond C. Fischer) Newsgroups: comp.sys.mac.programmer Subject: Re: Writing large PICT files??? Message-ID: <25d0a732.36b@polyslo.CalPoly.EDU> Date: 7 Feb 90 22:54:42 GMT References: <22163.25d040f6@kuhub.cc.ukans.edu> Reply-To: rcfische@polyslo.CalPoly.EDU (Raymond C. Fischer) Organization: Cal Poly State University -- San Luis Obispo Lines: 38 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