home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
utilities
/
utilsf
/
ifftext
/
ILBM
< prev
next >
Wrap
Text File
|
1993-06-21
|
21KB
|
489 lines
"ILBM" IFF Interleaved Bitmap
Date: January 17, 1986
From: Jerry Morrison, Electronic Arts
Status: Released and in use
1. Introduction
"EA IFF 85" is Electronic Arts' standard for interchange format files.
"ILBM" is a format for a 2 dimensional raster graphics image, specifically
an InterLeaved bitplane BitMap image with color map. An ILBM is an
IFF "data section" or "FORM type", which can be an IFF file or a part
of one. (See the IFF reference.)
An ILBM is an archival representation designed for three uses. First,
a standalone image that specifies exactly how to display itself (resolution,
size, color map, etc.). Second, an image intended to be merged into
a bigger picture which has its own depth, color map, and so on. And
third, an empty image with a color map selection or "palette" for
a paint program. ILBM is also intended as a building block for composite
IFF FORMs like "animation sequence" and "structured graphics". Some
uses of ILBM will be to preserve as much information as possible across
disparate environments. Other uses will be to store data for a single
program or highly cooperative programs while maintaining subtle details.
So we're trying to accomplish a lot with this one format.
This memo is the IFF supplement for FORM ILBM. Section 2 defines the
purpose and format of property chunks bitmap header "BMHD", color
map "CMAP", hotspot "GRAB", destination merge data "DEST", sprite
information "SPRT", and Commodore Amiga viewport mode "CAMG". Section
3 defines the standard data chunk "BODY". These are the "standard"
chunks. Section 4 defines the nonstandard color range data chunk "CRNG".
Additional specialized chunks like texture pattern can be added later.
The ILBM syntax is summarized in Appendix A as a regular expression
and in Appendix B as a box diagram. Appendix C explains the optional
run encoding scheme. Appendix D names the committee responsible for
this FORM ILBM standard.
Details of the raster layout are given in part 3, "Standard Data Chunk".
Some elements are based on the Commodore Amiga hardware but generalized
for use on other computers. An alternative to ILBM would be appropriate
for computers with true color data in each pixel.
Reference:
"EA IFF 85" Standard for Interchange Format Files describes the underlying
conventions for all IFF files.
Amiga[tm] is a trademark of Commodore-Amiga, Inc.
Electronic Arts[tm] is a trademark of Electronic Arts.
Macintosh[tm] is a trademark licensed to Apple Computer, Inc.
MacPaint[tm] is a trademark of Apple Computer, Inc.
2. Standard Properties
The required property "BMHD" and any optional properties must appear
before any "BODY" chunk. (Since an ILBM has only one BODY chunk, any
following properties are superfluous.) Any of these properties may
be shared over a LIST of FORMs IBLM by putting them in a PROP ILBM.
(See the "EA IFF 85" memo.)
BMHD
The required property "BMHD" holds a BitMapHeader as defined in these
C declarations and following documentation. It describes the dimensions
and encoding of the image, including data necessary to understand
the BODY chunk to follow.
typedef UBYTE Masking; /* Choice of masking technique. */
#define mskNone 0
#define mskHasMask 1
#define mskHasTransparentColor 2
#define mskLasso 3
typedef UBYTE Compression;
/* Choice of compression algorithm applied to the rows of all
* source and mask planes. "cmpByteRun1" is the byte run encoding
* described in Appendix C. Do not compress across rows! */
#define cmpNone 0
#define cmpByteRun1 1
typedef struct {
UWORD w, h; /* raster width & height in pixels */
WORD x, y; /* pixel position for this image */
UBYTE nPlanes; /* # source bitplanes */
Masking masking;
Compression compression;
UBYTE pad1; /* unused; for consistency, put 0 here */
UWORD transparentColor; /* transparent "color number" (sort of) */
UBYTE xAspect, yAspect; /* pixel aspect, a ratio width : height */
WORD pageWidth, pageHeight; /* source "page" size in pixels */
} BitMapHeader;
Fields are filed in the order shown. The UBYTE fields are byte-packed.
The fields w and h indicate the size of the image rectangle in pixels.
Each row of the image is stored in an integral number of 16 bit words.
The number of words per row is Ceiling(w/16). The fields x and y indicate
the desired position of this image within the destination picture.
Some reader programs may ignore x and y. A safe default for writing
an ILBM is (x, y) = (0, 0).
The number of source bitplanes in the BODY chunk (see below) is stored
in nPlanes. An ILBM with a CMAP but no BODY and nPlanes = 0 is the
recommended way to store a color map.
Note: Color numbers are color map index values formed by pixels in
the destination bitmap, which may be deeper than nPlanes if a DEST
chunk calls for merging the image into a deeper image.
The field masking indicates what kind of masking is to be used for
this image. The value mskNone designates an opaque rectangular image.
The value mskHasMask means that a mask plane is interleaved with the
bitplanes in the BODY chunk (see below). The value mskHasTransparentColor
indicates that pixels in the source planes matching transparentColor
are to be considered "transparent". (Actually, transparentColor isn't
a "color number" since it's matched with numbers formed by the source
bitmap rather than the possibly deeper destination bitmap. Note that
having a transparent color implies ignoring one of the color registers.
See CMAP, below.) The value mskLasso indicates the reader may construct
a mask by lassoing the image as in MacPaint*. To do this, put a 1
pixel border of transparentColor around the image rectangle. Then
do a seed fill from this border. Filled pixels are to be transparent.
Issue: Include in an appendix an algorithm for converting a transparent
color to a mask plane, and maybe a lasso algorithm.
A code indicating the kind of data compression used is stored in compression.
Beware that using data compression makes your data unreadable by programs
that don't implement the matching decompression algorithm. So we'll
employ as few compression encodings as possible. The run encoding
byteRun1 is documented in Appendix C, below.
The field pad1 is a pad byte and must be set to 0 for consistency.
This field could get used in the future.
The transparentColor specifies which bit pattern means "transparent".
This only applies if masking is mskHasTransparentColor or mskLasso
(see above). Otherwise, transparentColor should be 0.
The pixel aspect ratio is stored as a ratio in the two fields xAspect
and yAspect. This may be used by programs to compensate for different
aspects or to help interpret the fields w, h, x, y, pageWidth, and
pageHeight, which are in units of pixels. The fraction xAspect/yAspect
represents a pixel's width/height. It's recommended that your programs
store proper fractions in BitMapHeaders, but aspect ratios can always
be correctly compared with the the test
xAspect%yDesiredAspect = yAspect%xDesiredAspect
Typical values for aspect ratio are width : height = 10 : 11 (Amiga
320 x 200 display) and 1 : 1 (Macintosh*).
The size in pixels of the source "page" (any raster device) is stored
in pageWidth and pageHeight, e.g. (320, 200) for a low resolution
Amiga display. This information might be used to scale an image or
to automatically set the display format to suit the image. (The image
can be larger than the page.)
CMAP
The optional (but encouraged) property "CMAP" stores color map data
as triplets of red, green, and blue intensity values. The n color
map entries ("color registers") are stored in the order 0 through
n-1, totaling 3n bytes. Thus n is the ckSize/3. Normally, n would
equal 2nPlanes.
A CMAP chunk contains a ColorMap array as defined below. (These typedefs
assume a C compiler that implements packed arrays of 3-byte elements.)
typedef struct {
UBYTE red, green, blue; /* color intensities 0..255 */
} ColorRegister; /* size = 3 b