[Re: PICT format]

Athel athel at ir2cbm.cnrs-mrs.fr
Wed Sep 17 17:39:10 EST 1997


Petr Kuzmic asked:

>Athel, is there any particular reason for the _bitmap_ format?

Only that the original data consist of a large number (typically around
10000) of points with known coordinates.

Putting the question more generally, if you wanted to write a file
containing the coordinates of 10000 points in a format that a drawing
program (not a graph-plotting program like DeltaGraph or KaleidaGraph)
could read, what format would you choose?

In case you were also tempted to ask "is there any particular reason for
the PICT format?", I didn't realize when I asked the question that this
was a vector format, in fact I still find it rather puzzling, given that
my scanner software seems to like writing in PICT and it's not obvious
to me that what a scnner sees is vectorial. Basically, the facts that my
scanner can write PICT files and that SuperPaint can read them were the
main reasons for thinking PICT would be a good bet.

Anyway, the responses to the question (including some that were not
posted on the news group) were very useful, and I now know a lot more
about the PICT format than I did a couple of weeks ago. The solution to
my original problem came from a message sent to me privately, but which
is similar to the reply posted by P.L. Taylor, i.e.

> Not at all - it could hardly be simpler in fact.
> Takes just 3 lines of code:
> 
> OpenPicture(aPicHandle);
> CopyBits(myBitMap, myBitMap, myBitMap.bounds, myBitMap.bounds,
> SrcCopy, Nil);
> ClosePicture;

Instead of the CopyBits call, the suggestion was just to stick all the
Quickdraw calls one would use for drawing on the screen between
OpenPicture and ClosePicture. You also need to write 512 zero bytes at
the beginning of the file. 

This produced a file less than 5% of the size that DeltaGraph seems to
think necessary, with results that are indistinguishable when read into
SuperPaint and printed. This again raises the question of what on earth
DeltaGraph needs 1.6 MB to say: even the PICT file must be pretty
bloated given that expressing a bit map as vectors presumably means
storing the instructions for drawing 10000 lines of zero length. (In
case you're wondering, yes, that's how I draw a pixel in Quickdraw:
MoveTo(x,y); LineTo(x,y);  It's obviously inefficient, but it works).

Incidentally, I was delighted to see from P.L. Taylor's posting that I'm
not the last remaining person in the world who writes in Pascal and not
*!$''ing C.

Athel

Email: athel at bigfoot.com
Home page: http://ir2lcb.cnrs-mrs.fr/lcbpage/athel/homepage.htm
MCA FAQ: http://ir2lcb.cnrs-mrs.fr/lcbpage/athel/mcafaq.htm
MCA chapter from my book:
http://ir2lcb.cnrs-mrs.fr/lcbpage/athel/mcai.htm





More information about the Comp-bio mailing list