TITLE: DCOL IFF-ILBM chunk proposal

Form/Chunk ID: Chunk DCOL (ILBM direct color description)
Date Submitted: June 25, 1993
Submitted by: Ingo Wilken
              Bloherfelder Str. 72
              26129 Oldenburg
              Germany
              email: Ingo.Wilken@informatik.uni-oldenburg.de
Supporting software: experimental implementation in ppmtoilbm/ilbmtoppm
                     (from the PBMPlus package)

PURPOSE:
--------
With the growing number of 3rd-party graphic boards that support direct
color (for example "HiColor", 5:5:5, 6:5:5, 5:6:5 or 5:5:6 RGB encoded
in a word, one word per pixel), I've been thinking about how to store such
images in an IFF file.   There is already a format that does something
similar: deep (24bit) ILBM, but storing (for example) a 5:5:5 direct color
picture in a deep ILBM would waste 9 planes.  Now, my idea is to generalize
the deep ILBM format to support a different number of bits for red, green and
blue each instead of the fixed 8:8:8 planes in deep ILBMs.  A deep ILBM can
then simply bee seen as a special case of a direct color ILBM with 8 bits
for each color component.

Now we need a way to determine whether a ILBM is a normal file with the
bits giving an index into a colormap, or a direct color ILBM with absolute
RGB values.  We also need a way to store how many planes are used for red,
green and blue values.  The easiest and most flexible way to store this
information is a new chunk, DCOL (direct color description).  The presence of
this chunk indicates a direct color ILBM, otherwise it's a colormap-indexed
ILBM (since a colormap-indexed ILBM with 24 planes doesn't make much sense,
we can safely assume that a 24-plane ILBM is a 8:8:8 direct color ILBM even
without the presence of a DCOL chunk).


SPECIFICATION:
--------------
/* IFF chunk ID macro for a DCOL chunk */
#define ID_DCOL    MakeID('D','C','O','L')

typedef struct {
    UBYTE r;      /* number of bits (planes) for reds */
    UBYTE g;      /* number of bits (planes) for greens */
    UBYTE b;      /* number of bits (planes) for blues */
    UBYTE pad1;   /* reserved, ignore on read, write as 0 */
} DirectColor;

The number of planes given in BMHD.nPlanes must be the same as the
sum of the planes in the DCOL chunk.

Bits in a direct color ILBM are stored similar to deep ILBMs:
    saved                                                    saved
    first --------------------------------------------------> last
    R(0) R(1) ... R(r-1) G(0) G(1) ... G(g-1) B(0) B(1) ... B(b-1)

This means a reader program that supports deep ILBMs can easily be modified
to support direct color ILBMs (at least upto 8 planes per color component).


NOTES
-----
This format is extremly flexible, for example is allows the storage of a
possible future 'super true color' image with 16 or even 32 bits for red,
green and blue each.

I've been asked why I named this chunk 'direct color' = 'DCOL' instead
of 'true color' = 'TCOL' or 'TRCL'.  It's simply because 'true color' is
usually associated with 24-bit images.

