Q: Can I use the CompressPicture routine to spool in a
source picture from disk by overriding the QuickDraw proc getPicProc as
documented in Inside Macintosh Volume V, pages 88-89? I'm trying to save the
contents of an off-screen GWorld as a compressed PICT resource. Unfortunately
there's no direct way to compress the GWorld 's pixel map to a resource.
A: We definitely don't recommend trying to spool in or out
the results of CompressPicture or CompressImage . We recommend doing one of the following instead:
- You can compress the
GWorld using CompressImage and then call OpenPicture ,
DecompressImage , and ClosePicture using a data-unloading picture proc. The
drawback here is that you need to have a copy of the compressed image in
memory.
- If it's unacceptable to have an entire compressed image in memory, you can
consider banding along with data unloading: Call
OpenPicture , then
CompressImage and DecompressImage on a band, CompressImage and DecompressImage
on another band, and so on. When all bands are done, call ClosePicture . The
drawback for this is that the compressed picture will have bands of image data
that won't display well dithered. This could be an issue, but the best way to
find out is to try it.
The second suggestion is probably the best idea if you want to keep your memory
footprint small. But much of the decision depends on your application.
|