Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!caen.engin.umich.edu!mystone From: mystone@caen.engin.umich.edu (Dean Yu) Newsgroups: comp.sys.mac.programmer Subject: Re: UnpackBits question Keywords: Macpaint file, LSC Message-ID: <426763f9.fb61@kirk.engin.umich.edu> Date: 3 Apr 89 04:16:00 GMT References: <1709@ncar.ucar.edu> Reply-To: mystone@sol.engin.umich.edu (Dean Yu) Distribution: usa Organization: Computer Aided Engineering Network, University of Michigan Lines: 27 In article <1709@ncar.ucar.edu> bill@hao.ucar.edu (Bill Roberts) writes: >I want to read a Macpaint file, unpack the bit image and write out the unpacked >bits to a file. Simply enough, right? But IM sez > > UnpackBits (VAR srcPtr, dstPtr: Ptr; dstBytes: INTEGER); > >where dstBytes is the length that the expanded data will be; it should be the >value that was passed to PackBits. Now, I don't know what that value is. Can >anyone give me a hint on how to find out this value. MacPaint uses the maximum number of bytes that PackBits can pack at once, namely 127 bytes. So you should call UnpackBits with dstBytes equal to 127. By the way, one of the earlier Tech Notes -- I forget which one; I think it's in the teens -- has a sample program that will read a MacPaint file. _______________________________________________________________________________ Dean Yu | E-mail: mystone@{sol,caen}.engin.umich.edu University of Michigan | Real-mail: Dean Yu Computer Aided Engineering Network | 2413 Kelsey House ===================================| 600 E Madison "These are MY opinions." (My | Ann Arbor, MI 48109 employer doesn't want them. |=========================================== Actually, they don't really care | what I think. But President | This space intentionally left blank. Duderstadt does...) | -------------------------------------------------------------------------------