desai@robotics.jpl.nasa.gov (Rajiv Desai) (07/12/89)
I would like to able to save a picture data structure (created using OpenPicture) in a file as a PICT resource or some other way such that other applications (e.g. PixelPaint) etc can read it. I am using Light Speed C. I would appreciate if someone could help me with this. Thanx. - Rajiv Rajiv S. Desai Jet Propulsion Laboratory desai@robotics.jpl.nasa.gov Rajiv S. Desai Jet Propulsion Laboratory desai@robotics.jpl.nasa.gov
earleh@eleazar.dartmouth.edu (Earle R. Horton) (07/12/89)
In article <306@forsight.Jpl.Nasa.Gov> desai@robotics.jpl.nasa.gov (Rajiv Desai) writes: > >I would like to able to save a picture data structure >(created using OpenPicture) in a file as a PICT resource or >some other way such that other applications (e.g. >PixelPaint) etc can read it. > One fairly standard way to store this sort of thing is in a PICT file. A technique for creating PICT files is discussed in Inside Macintosh V, in the QuickDraw chapter. This can be used for both color and non-color pictures. I have successfully used this technique in several programs, including my XBitMap-to-PICT converter, the source to which is on sumex-aim.stanford.edu in /info-mac/source/c. Other examples are available from Apple via their Sample Code program. Apple Sample Code can be ftp-ed from Apple.com, in /pub/dts, and is available from APDA. The format of a PICT file is a 512 byte header, followed by the picture contents. A suitable header is 512 zero bytes. If you have a valid Picture stored in a PicHandle, and created by a sequence of OpenPicture--drawing commands--ClosePicture, then you should be able to write it out to a PICT file directly, although I have not tried this method. Create a data file of type PICT. Write 512 zero bytes to it. Write the contents of the picture handle. Close the file. See what PixelPaint says about opening that file. Earle R. Horton "People forget how fast you did a job, but they remember how well you did it." Salada Tag Lines