Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pcltrans(1)

lp(1M)

Reference

file_to_bitmap(3G)

file_print(3G)

BITMAPFILE(4)

NAME

bitmapfile − Starbase bitmap file

HP-UX COMPATIBILITY

Level: HP-UX/STANDARD

Origin: HP

Remarks: This entry describes the format of bitmap files created by the bitmap_to_file(3G) procedure.  Other programs may also create files in this 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];       /* "Bitmapfile" */
        int rev;                /* revision of file format */
        char device_id[16];     /* device or driver name
                                   (e.g. hp300h) */
        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,
                                   -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 cmap_mode;          /* color map mode:
                                   0 = normal color mode.
                                   1 = monotonic color mode.
                                   2 = full color mode. */
        int csize;              /* 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 csize field in the header structure.  This array is defined as:
 
        float cmap[csize][3];
 

Bitmap Data

Bitmap data may be stored either in pixel-major or plane-major format.  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 eight planes are written as the first bank, followed by the data for the next eight 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

HP-UX Reference, pcltrans(1), lp(1M). 
 
Starbase Reference,bitmap_to_file(3G), file_to_bitmap(3G), file_print(3G). 
 
Starbase Graphics Techniques,"Storing and Printing Images". 

Hewlett-Packard Company  —  May 11, 2021

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