[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] How to read PICT files



|Any suggestions?

Here's a few, in no particular order:

- I think you'd want to use the 'n' and 'N' unpack formats. The fields in
  a PICT are in the native format for a 68K, which is big-endian, so using
  'n' and 'N' guarantee you're unpacking in big-endian format.
- The PICT size stored in the PICT isn't used, as it limits a PICT to 32K.
  If you need to know the size of the PICT, just use the size of the file.
- Except for the first few fields, the format of a PICT isn't really
  documented (well, it is, but it's "subject to change", plus it's far
  easier to let the system decode it than doing it yourself), so the
  "standard" way to get at the actual bits in the picture is to draw it
  into and offscreen GWorld, get the GWorld's pixmap, then crawl through
  that. MacPerl does support offscreen Quickdraw, see lib:Mac:QDOffScreen.pm,
  and PixMaps, see lib:mac:QuickDraw.pm. The downside is that I haven't had
  much luck getting QDOffScreen to work, although I've only spent maybe 5
  minutes working with it. Also, you'll almost assuredly need Inside Mac to
  figure out how to use the QDOffScreen stuff.

Hope this helps,
Brian

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch