Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

RASTERFILE(5)  —  FILE FORMATS

NAME

rasterfile − Sun’s file format for raster images

SYNOPSIS

#include <rasterfile.h>

DESCRIPTION

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 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. 

The header is defined by the following structure:

struct rasterfile {
intras_magic;
intras_width;
intras_height;
intras_depth;
intras_length;
intras_type;
intras_maptype;
intras_maplength;
};

The ras_magic field always contains the following constant:

#defineRAS_MAGIC0x59a66a95

The ras_width, ras_height, and 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 ras_length field contains the length in bytes of the image data.  For an unencoded image, this number is computable from the ras_width, ras_height, and 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 ras_length field; it is only the image data length.  For historical reasons, files of type RT_OLD will usually have a 0 in the ras_length field, and software expecting to encounter such files should be prepared to compute the actual image data length if needed.  The ras_maptype and ras_maplength fields contain the type and length in bytes of the colormap values, respectively.  If ras_maptype is not RMT_NONE and the ras_maplength is not 0, then the colormap values are the ras_maplength bytes immediately after the header.  These values are either uninterpreted bytes (usually with the ras_maptype set to RMT_RAW) or the equal length red, green and blue vectors, in that order (when the ras_maptype is RMT_EQUAL_RGB).  In the latter case, the ras_maplength must be three times the size in bytes of any one of the vectors. 

FILES

/usr/include/rasterfile.h

SEE ALSO

SunView 1 Programmer’s Guide

Sun Release 4.0  —  Last change: 19 October 1987

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026