Newsgroups: comp.graphics
Path: utzoo!utgpu!topix
From: topix@gpu.utcs.utoronto.ca (R. Munroe)
Subject: Re: 24-bit color Pict-2?
Message-ID: <1991Jan4.020120.16318@gpu.utcs.utoronto.ca>
Organization: UTCS Public Access
References: <1991Jan3.065804.17254@msuinfo.cl.msu.edu>
Date: Fri, 4 Jan 91 02:01:20 GMT

In article <1991Jan3.065804.17254@msuinfo.cl.msu.edu> raja@cpswh.cps.msu.edu writes:
>
>Excuse what may be an elementary question...
>does PICT-2 support 24-bit color?  (for
>example, the GIF image format supports only
>8-bit colormapped images, whereas TIFF or
>Sun rasterfile formats can deal with 24 bits).
>
>Also, how is PICT-2 different from PICT-1?
>
>Thanks in advance,
>
>
>Narayan Sriranga Raja.


Yes, PICT2 supports 24 bit images.  Actually, PICT2 supports 2, 4, 8, 16, and 32
bits per pixel.  The 32 bit format allows you to disregard the last 8 bits
or use them for anything you like (alpha, etc.).  2, 4, and 8 bit images
are indexed color, while 16 and 32 bit are direct.  PICT2 differs from PICT1
in that PICT1 supports only 1 bit per pixel.  PICT2 was Apple's first real
implementation of color (early Macs understood 8 colors but could not
display them).  The first release of Color QuickDraw (Macintosh color
drawing toolbox) supported up to 8 bits per pixel.  The fairly recent release
of 32 Bit Color QuickDraw allows Mac applications to create up to 
32 bit per pixel PICT2 files.  One word of warning:  if you are planning
on writing a PICT filter you should have no trouble converting to 
PICT format.  However, if you are planning on reading a PICT file things
will be much more difficult.  PICT files can contain everything from
bit maps to geometry to comments to text.  There are dozens of opcodes
that a PICT reader would have to handle. (This assumes that the PICT reader
is being developed on a system OTHER than a Mac - if it's going to be on a 
Mac things are much easier - toolbox calls will handle reading and writing
PICT files for you).

There is source code for a Portable Bit Map to PICT (and vice versa) utility.
The code can be found at any ftp site that archives the PBM set.
Although the code is a nice starting point, it doesn't properly
handle (or even skip) non-bitmap opcodes.  It also only works on PICT2
files of up to 8 bits per pixel.

Bob Munroe
topix@utcs.utoronto.ca


