Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!seas.gwu.edu!viraf From: viraf@seas.gwu.edu (Viraf Bankwalla) Newsgroups: comp.sys.mac.programmer Subject: RE: Need PICT help Message-ID: <1837@sparko.gwu.edu> Date: 4 May 90 19:20:27 GMT Reply-To: viraf@seas.gwu.edu () Organization: The George Washington University, Washington D.C. Lines: 71 Hi, I'm writing a program which can load in various PICT files. My problem lies in determining the characteristics of the source. There are three types of PICT files (or so I think) versionOne // BitImage. Old style PICT versionTwo // PixMap. Support for color. Chunky // CLUT - supports {1, 2, 4, 8} bits per pixel RGBDirect // Direct - supports {16, 32} bits per pixel. OK. So I open up the 'PICT' file, and look at the header int picSize; // low word of picture size Rect picFrame; // picture frame in 72dpi switch (version) { case versionOne: // opcodes are one byte long opVersion = 0x11 // version opcode 0x01 // DATA - version number OPCODE - BYTE // OPCODES followed by DATA DATA OPCODE - BYTE DATA :::: :::: :::: opEndPic = 0xFF // End of picture opcode case versionTwo: // opcodes are one word long opVersion = 0x0011 // version opcode 0x02FF // DATA - version number HeaderOp = 0x0C00 // Version2 PICT have a header // before playback defination DATA - 24 bytes ::::::: ::::::: opPicEnd = 0x00ff // End of picture } The 24 bytes of data is defined as longint Version2 = -1 unsigned hex longint // Fixed point bounding box unsigned hex longint unsigned hex longint unsigned hex longint longint Version2 = -1 // RESERVED Distinguishing between versionOne and versionTwo is easy. If versionOne I allocate memory for a BitMap. I need to distinguish between a RGBDirect and Chunky PICT so that I may create and appropiate GDevice, and allocate memory for the PixMap. It would be nice to be able to get the pixMap struct, and intrepret it. Any suggestions ??? I thought of replacing StdBits as it provides the source pixMap (dest = current port), but then I'd have to spool in the PICT twice - once to gather info and then to actually draw it. Is there a better way ?? What should one do if the destination is composed from two sources which have different resolutions ?? Apple strongly recommends letting QuickDraw parse the picture, and thus I dont want to sit down putting YACC to work. Any help would be greatly appreciated. Thanks once again. viraf bankwalla viraf@seas.gwu.edu uunet!gwusun!viraf