.\" @(#)rasterfile.5 1.11 90/02/15 SMI; Sun-specific
.TH RASTERFILE 5 "19 October 1987"
.SH NAME
rasterfile \- Sun's file format for raster images
.SH SYNOPSIS
.B #include <rasterfile.h>
.SH DESCRIPTION
.LP
A rasterfile is composed of three parts:
first, a header containing 8 integers;
second, a (possibly empty) set of colormap values;
and third, the pixel image, stored a line at
a time, in increasing
.I y
order.  The image is layed out in the file
as in a memory pixrect.  Each line of the
image is rounded up to the nearest 16 bits.
.IX "rasterfile"
.LP
The header is defined by the following structure:
.LP
.RS
.nf
.ft B
struct rasterfile {
	int	ras_magic;
	int	ras_width;
	int	ras_height;
	int	ras_depth;
	int	ras_length;
	int	ras_type;
	int	ras_maptype;
	int	ras_maplength;
};
.fi
.ft R
.RE
.LP
The
.I ras_magic
field always contains the following constant:
.IP
.B #define	\s-1RAS_MAGIC\s0	0x59a66a95
.LP
The
.IR ras_width ,
.IR ras_height ,
and
.I ras_depth
fields contain the image's width and height in pixels,
and its depth in bits per pixel, respectively.
The depth is either 1 or 8, corresponding
to standard frame buffer depths.  The
.I ras_length
field contains the length in bytes of the image data.
For an unencoded image, this number is
computable from the
.IR ras_width ,
.IR ras_height ,
and
.I ras_depth
fields, but for an encoded image it must be explicitly stored in
order to be available without decoding the image itself.
Note: the length of the header and of
the (possibly empty)
colormap values are not included in the value of the
.I ras_length
field; it is only the image data length.
For historical reasons, files of type
.SM RT_OLD
will usually have a 0 in the
.I ras_length
field, and software expecting to encounter such files
should be prepared to compute the actual
image data length if needed.  The
.I ras_maptype
and
.I ras_maplength
fields contain the type and length in
bytes of the colormap values, respectively.  If
.I ras_maptype
is not
.SM RMT_NONE
and the
.I ras_maplength
is not 0, then the colormap values are the
.I ras_maplength
bytes immediately after the header.
These values are either uninterpreted
bytes (usually with the
.I ras_maptype
set to
.SM RMT_RAW\s0)
or the equal length red, green and blue
vectors, in that order (when the
.I ras_maptype
is
.SM RMT_EQUAL_RGB\s0).
In the latter case, the
.I ras_maplength
must be three times the size in bytes
of any one of the vectors.
.\".SH FILES
.\".PD 0
.\".TP 20
.\".B /usr/include/rasterfile.h
.\".PD
.SH SEE ALSO
.TX SVPG
