Path: utzoo!mnetor!uunet!husc6!bloom-beacon!gatech!mcnc!thorin!unc!steele
From: steele@unc.cs.unc.edu (Oliver Steele)
Newsgroups: comp.sys.mac.programmer
Subject: Spooling a PICT2
Message-ID: <2620@thorin.cs.unc.edu>
Date: 9 May 88 04:15:45 GMT
Sender: news@thorin.cs.unc.edu
Reply-To: steele@unc.UUCP (Oliver Steele)
Organization: University Of North Carolina, Chapel Hill
Lines: 35

I need to save a color bitmap as a PICT file.  Here's what I've tried:

1) Opening a CGrafPort and a picture, doing a CopyBits from the port to
itself, closing the picture, and saving it to disk.  For a 640x480
picture, this bombs during the CopyBits, even with 5M of memory, whether
I've called MaxApplZone or not.  QuickerGraf is enabled, for what that's
worth.

2) Same as (1), but CopyBitsing in bands.  This works perfectly,
even when all the CopyBits are wrapped in a single picture, but it
doubtless makes a larger PICT file than necessary, and it definitely
takes longer to draw than...

3) Same as (1), only change the port's grafProcs to one that's been
initialized with SetStdCProcs, and change the grafProcs' putPicProc as per
IM5.  (LSC bug:  a CGrafPort's grafProcs is defined as a QDProcsPtr
instead of a CQDProcsPtr.) This is pretty much straight from IM5, so I
doubt I've messed this up.  This also works perfectly, and gets me a much
smaller PICT file than (2), but the color table is all wrong.  This is
true even if I use an OpenCPort to open both the port I'm copying from
when I make the file and the one I'm copying to when I display it, or if
I use another program to display the PICT file.  Also, for fairly small
rectangles (say 10x10), an application that tries to display the PICT file
locks, but I suspect this is an independent bug.

Although I'd like to know why (1) bombs and (2) doesn't, I'd really like
to spool the pictures instead of doing (1) or (2) since I want them on
disk anyway and I don't want to need a half meg MF partition.  Has anybody
done (3) successfully, for color pictures?

 ---------------------------------------------------------------------------
 Oliver Steele					  ...!decnet!mcnc!unc!steele
 UNC-CH							   steele@cs.unc.edu

 "We made it structured, and now it doesn't work." -- Brice Tebbs