[Re: PICT format]

Dr. P.L. Taylor ptaylor at hgmp.mrc.ac.uk
Thu Sep 11 15:41:58 EST 1997

In article <3416671B.476B at ibsm.cnrs-mrs.fr>,
Athel  <athel at ir2cbm.cnrs-mrs.fr> wrote:
>Can anyone tell me where I can find out how (Macintosh) files in PICT
>format are actually formatted, so that I can write programs that will
>write PICT files that commercial drawing programs will be able to read?
>I am interested in the simplest possible case, i.e. where the picture is
>just a black and white bitmap.
-- d.gilbert--biocomputing--indiana u--bloomington--gilbertd at bio.indiana.edu

>Your choice of a bitmap is not the simplest PICT output -- it
>is kind of tricky.  PICT is mostly a vector drawing format,
>like Postscript, and adding bitmaps requires some complex
>compression and bit counting.

Not at all - it could hardly be simpler in fact.  
Takes just 3 lines of code:

CopyBits(myBitMap, myBitMap, myBitMap.bounds, myBitMap.bounds,
			SrcCopy, Nil);

aPicHandle is a PicHandle which will hold the picture.

What this does is copy the bitmap to itself, while recording the
operation into a picture.  You don't have to know anything about
the internal structure of the picture, the toolbox does it all
for you.

To save the data in aPicHandle to a file, first write a 512-byte
header consisting of all zeroes, then follow it with the contents
of aPicHandle.  FileType should (of course) be 'PICT'.

If you need more details mail me.

Phil Taylor                         |        MRC Reproductive Biology Unit
                                    |        Centre for Reproductive Biology
                                    |        37 Chalmers Street
mbplt at seqnet.dl.ac.uk               |        Edinburgh EH3 9EW
ptaylor at hgmp.mrc.ac.uk              |        Scotland.

More information about the Comp-bio mailing list