HPUX bitmapfile[4]

bitmapfile(4G) bitmapfile(4G)
NAME
bitmapfile - Starbase bitmap file format
DESCRIPTION
A bitmap file created by Starbase for bitmap archival or printing has
the following overall structure. The offsets to bitmap data and user
data areas are recorded in fields of the header structure.
byte offset contents
0 header structure (see below)
256 color map (if present)
arbitrary * bitmap data
arbitrary ** user data (if present)
* depends upon size of the color map
** depends upon size of color map and bitmap data
Header
The 256 byte header block has the following structure:
struct bf_header
{
char file_id[16]; /* bitmap file "name" */
int rev; /* revision of file format */
char device_id[16]; /* device or driver name (e.g. "hpgcrx") */
int bm_loc; /* offset in bytes to start of bitmap
information bytes measured from the start of
the file */
int eod_loc; /* byte offset of last byte of HP data in the
file. User data may be appended after this
point. */
int xstart,ystart; /* upper left corner of source in pixels
(This is pixel 0,0 in the file */
int xlen,ylen; /* x,y dimensions of bitmap in pixels */
int bm_mode; /* format of bitmap data:
-1 - pixel-major, full-depth,
Hewlett-Packard Company - 1 - HP-UX Release 9.0: August 1992
bitmapfile(4G) bitmapfile(4G)
-2 - plane-major, full-depth,
>= 0 - plane-major, single-plane
(source plane was this number.)
(plane 0 = least significant.) */
int depth; /* number of bits stored per pixel. This
indicates how many planes were stored. */
int pixel_align; /* alignment of pixel data in the file.
Allowable values are 1 and 8.
1 means every bit is a pixel,
8 means every byte is a pixel. */
int num_banks; /* Number of banks. Only relevant for pixel-
major format. */
int disp_en; /* display enable mask of source */
int cmap_mode; /* color map mode:
0 = normal color mode.
1 = monotonic color mode.
4 = full color mode. */
int cmap_size; /* Number of color map entries */
int back_index; /* Index value of background color entry in
the color map */
char hp_extend[100]; /* Reserved for HP extensions */
char user_extend[64]; /* Reserved for user extensions */
}
Color Map
The color map is stored as an array of float triples, representing
red, green, and blue levels in the range 0.0 to 1.0. The color map
starts at byte offset 256; the number of entries is indicated by the
cmap_size field in the header structure. This array is defined as:
float color_map[cmap_size][3];
Bitmap Data
Bitmap data may be stored either in pixel-major or plane-major format.
Hewlett-Packard Company - 2 - HP-UX Release 9.0: August 1992
bitmapfile(4G) bitmapfile(4G)
Single-plane bitmaps are stored in plane-major format.
Pixel-Major format
Pixel-major means that bits from several planes, all corresponding to
one pixel, are stored in a single byte. When there are more than
eight planes, the data is written in banks; all the data for the the
least significant 8 planes are written as the first bank, followed by
the data for the next 8 planes as the second bank, and so on up to the
most significant planes in the last bank. Within a bank, consecutive
bytes correspond to consecutive pixels. The last byte of the first
row is followed immediately by the first byte of the second row, etc.
Pixels are ordered first by x value from left (column 0) to right
(column xlen-1), and second by y value from top (row 0) to bottom (row
ylen-1). Banks are written without padding; the last byte of a bank
is followed immediately by the first byte of the next bank. The
storage required per bank in the file is thus xlen * ylen bytes.
Plane-Major format
Plane-major means that all the data from one plane, for all pixels,
are stored in adjacent positions in the file. This means that the
bits from a single plane are packed, eight pixels per byte. Each
pixel row begins on the next byte boundary. Pixels are ordered as for
pixel-major data. Consequently, the most significant bit of the
first byte corresponds to the leftmost pixel of the first row, and the
least significant bit of the first byte corresponds to the eighth
pixel. The storage required per plane is ((xlen + 7) div 8) * ylen
bytes.
Planes are padded only to the next byte boundary; when multiple planes
are stored in a file, the last byte of each plane is followed
immediately by the first byte of the next plane. Planes are stored in
the file consecutively from least significant to most significant.
SEE ALSO
Starbase Reference: bitmap_to_file(3G), file_to_bitmap(3G),
file_print(3G), pcltrans(1).
Starbase Graphics Techniques: "Storing, Retrieving, and Printing
Images".
HP-UX Reference: lp(1M).
Hewlett-Packard Company - 3 - HP-UX Release 9.0: August 1992