home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 14 Text
/
14-Text.zip
/
BMAPFMT.ZIP
/
TEXT.TMP
Wrap
Text File
|
1992-06-27
|
18KB
|
481 lines
The operating system uses the same file format for bit maps, icons, and pointers in
resource files. In the following description, "bit map" refers to bit maps, icons, and
pointers unless otherwise specified.
Two formats are supported. In the first, a single-size version of the bit map is defined.
This is used whatever the target device.
The second format allows multiple versions of the bit map to be defined, including one
or more device-independent versions, and a number of device-dependent versions, each
intended for use with a particular device.
In the case of icons and pointers, when more than one version of the bit map exists, the
preferred version is one that matches the device size of icon or pointer. Otherwise the
device-independent version is used to scale a bit map to the required size.
The operating system provides pointers that match the requirements of the display device
in use, typically pointers are 32x32 pels, one bit per plane.
Icons provided with the operating system are designed to match the requirements of the
most common display devices. The following versions of each icon are included in each
file:
32x32 4 bpp (16 color)
40x40 4 bpp (16 color)
32x32 1 bpp (black and white)
20x20 1 bpp (black and white)
16x16 1 bpp (black and white)
The 32x32 versions are designed for VGA displays and for device-independent use.
The 40x40 version is for 8514/A and XGA displays.
The 20x20 and 16x16 are half-size icons designed for use as mini-icons.
For general bit maps, which may be of arbitrary size, the preferred version is one
matching the requested bit map size; otherwise one matching the display size is
selected. If neither is available, the device-independent version is used from which to
scale a bit map.
For both formats, the definition consists of two sections. The first section contains
general information about the type, dimensions, and other attributes of the resource.
The second section contains data describing the pels that make up the bit map(s), and
is in the format specified in Bit-Map Data.
In the multiple-version format, the first section contains an array of
BITMAPARRAYFILEHEADER structures. or BITMAPARRAYFILEHEADER2 structures. The
format of these is as follows:
typedef struct _BITMAPARRAYFILEHEADER { /* bafh */
USHORT usType;
ULONG cbSize;
ULONG offNext;
USHORT cxDisplay;
USHORT cyDisplay;
BITMAPFILEHEADER bfh;
} BITMAPARRAYFILEHEADER;
typedef BITMAPARRAYFILEHEADER *PBITMAPARRAYFILEHEADER;
typedef struct _BITMAPARRAYFILEHEADER2 { /* bafh */
USHORT usType;
ULONG cbSize;
ULONG offNext;
USHORT cxDisplay;
USHORT cyDisplay;
BITMAPFILEHEADER2 bfh2;
} BITMAPARRAYFILEHEADER2;
typedef BITMAPARRAYFILEHEADER2 *PBITMAPARRAYFILEHEADER2;
The fields in BITMAPARRAYFILEHEADER and BITMAPARRAYFILEHEADER2 have these
meanings:
usType
Type of structure. This is:
BFT_BITMAPARRAY (X'4142' - 'BA' for BITMAPARRAYFILEHEADER or
BITMAPARRAYFILEHEADER2)
cbSize
Size of the BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2 structure in
bytes.
offNext
Offset of the next BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2
structure from the start of the file
cxDisplay, cyDisplay
pel dimensions of the device for which this version is intended (for example, 640 x
480 for VGA).
The device-independent version must be the first BITMAPARRAYFILEHEADER or
BITMAPARRAYFILEHEADER2 defined.
In the single-size format, the BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2
structure is not present. The definition consists of one or two BITMAPFILEHEADER or
BITMAPFILEHEADER2 structures.
The format of the BITMAPFILEHEADER and BITMAPFILEHEADER2 structure is :
typedef struct _BITMAPFILEHEADER { /* bfh */
USHORT usType;
ULONG cbSize;
SHORT xHotspot;
SHORT yHotspot;
ULONG offBits;
BITMAPINFOHEADER bmp;
} BITMAPFILEHEADER;
typedef BITMAPFILEHEADER *PBITMAPFILEHEADER;
typedef struct _BITMAPFILEHEADER2 { /* bfh2 */
USHORT usType;
ULONG cbSize;
SHORT xHotspot;
SHORT yHotspot;
ULONG offBits;
BITMAPINFOHEADER2 bmp2;
} BITMAPFILEHEADER2;
typedef BITMAPFILEHEADER2 *PBITMAPFILEHEADER2;
BITMAPINFOHEADER2 is a standard data type (see above, and also
BITMAPINFOHEADER2).
The fields in BITMAPFILEHEADER and BITMAPFILEHEADER2 have these meanings:
usType
Type of resource the file contains. The valid values are:
BFT_BMAP (X'4D42' - 'BM' for bit maps)
BFT_ICON (X'4349' - 'IC' for icons)
BFT_POINTER (X'5450' - 'PT' for pointers).
BFT_COLORICON (X'4943' - 'CI' for color icons).
BFT_COLORPOINTER (X'5043' - 'CP' for color pointers).
cbSize
Size of the BITMAPFILEHEADER or BITMAPFILEHEADER2 structure in bytes.
xHotspot, yHotspot
Coordinates of the hotspot for icons and pointers. This field is ignored for bit maps.
offBits
Offset in bytes to the beginning of the bit-map pel data in the file, from the start of
the definition.
For icons and pointers, the cy field in bmp is actually twice the pel height of the image
that appears on the screen. This is because these types actually contain two full
bit-map pel definitions. The first bit-map definition is the XOR mask, which contains
invert information (0 = no invert, 1 = invert) for the pointer or icon. The second is the
AND mask, which determines whether the pointer or the screen is shown (0 =
black/white, 1 = screen/inverse screen).
For color icons or pointers, there are two bit-maps involved: one that is black and white
and consists of an AND and an XOR mask, and one that is color that defines the color
content.
The cy field in the BITMAPINFOHEADER2 structure for the color bit-map must be the real
height, that is, half the value specified for the black and white bit-map. The cx fields
must be the same.
The following table shows how these two bit-maps are used for a color icon or pointer:
XOR AND COLOR
1 1 x Invert screen
0 0 x Use color x
0 1 x Transparency
1 0 x Use color x
For color icons or pointers, two BITMAPFILEHEADER or BITMAPFILEHEADER2 structures
are therefore required:
BITMAPFILEHEADER2 with usType BFT_COLORICON or BFT_COLORPOINTER
BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
Color table
BITMAPFILEHEADER2 with same usType
BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
Color table
**
bits for one bit-map
**
**
bits for other bit-map
**
The usType for the first BITMAPFILEHEADER2 is either BFT_COLORICON or
BFT_COLORPOINTER. This means that a second BITMAPFILEHEADER2 is present as
part of the definition of a color icon or pointer. The first BITMAPFILEHEADER2 structure
contains the information for the black and white AND and XOR masks, while the second
BITMAPFILEHEADER2 structure contains the information for the color part of the pointer
or icon.
BITMAPFILEHEADER and BITMAPINFOHEADER can occur in place of
BITMAPFILEHEADER2 and BITMAPINFOHEADER2 in this example.
For the multiple version format, the file is as follows:
BITMAPARRAYFILEHEADER2 for device-independent version
BITMAPFILEHEADER2 (part of BITMAPARRAYFILEHEADER2)
BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
Color table
BITMAPFILEHEADER2 )
BITMAPINFOHEADER2 ) only if this is a color icon or pointer
Color table )
BITMAPARRAYFILEHEADER2 for first device-dependent version
BITMAPFILEHEADER2 (part of BITMAPARRAYFILEHEADER2)
BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
Color table
BITMAPFILEHEADER2 )
BITMAPINFOHEADER2 ) only if this is a color icon or pointer
Color table )
Further BITMAPARRAYFILEHEADER2 groups occur here as required
for additional device-dependent versions
**
bits for one bit-map
**
**
bits for next bit-map
**
And so on for as many bit-maps as necessary.
As before, BITMAPARRAYFILEHEADER, BITMAPFILEHEADER and BITMAPINFOHEADER
can occur in place of BITMAPARRAYFILEHEADER2, BITMAPFILEHEADER2 and
BITMAPINFOHEADER2.
The operating system uses the same file format for bit maps, icons, and pointers in
resource files. In the following description, "bit map" refers to bit maps, icons, and
pointers unless otherwise specified.
Two formats are supported. In the first, a single-size version of the bit map is defined.
This is used whatever the target device.
The second format allows multiple versions of the bit map to be defined, including one
or more device-independent versions, and a number of device-dependent versions, each
intended for use with a particular device.
In the case of icons and pointers, when more than one version of the bit map exists, the
preferred version is one that matches the device size of icon or pointer. Otherwise the
device-independent version is used to scale a bit map to the required size.
The operating system provides pointers that match the requirements of the display device
in use, typically pointers are 32x32 pels, one bit per plane.
Icons provided with the operating system are designed to match the requirements of the
most common display devices. The following versions of each icon are included in each
file:
32x32 4 bpp (16 color)
40x40 4 bpp (16 color)
32x32 1 bpp (black and white)
20x20 1 bpp (black and white)
16x16 1 bpp (black and white)
The 32x32 versions are designed for VGA displays and for device-independent use.
The 40x40 version is for 8514/A and XGA displays.
The 20x20 and 16x16 are half-size icons designed for use as mini-icons.
For general bit maps, which may be of arbitrary size, the preferred version is one
matching the requested bit map size; otherwise one matching the display size is
selected. If neither is available, the device-independent version is used from which to
scale a bit map.
For both formats, the definition consists of two sections. The first section contains
general information about the type, dimensions, and other attributes of the resource.
The second section contains data describing the pels that make up the bit map(s), and
is in the format specified in Bit-Map Data.
In the multiple-version format, the first section contains an array of
BITMAPARRAYFILEHEADER structures. or BITMAPARRAYFILEHEADER2 structures. The
format of these is as follows:
typedef struct _BITMAPARRAYFILEHEADER { /* bafh */
USHORT usType;
ULONG cbSize;
ULONG offNext;
USHORT cxDisplay;
USHORT cyDisplay;
BITMAPFILEHEADER bfh;
} BITMAPARRAYFILEHEADER;
typedef BITMAPARRAYFILEHEADER *PBITMAPARRAYFILEHEADER;
typedef struct _BITMAPARRAYFILEHEADER2 { /* bafh */
USHORT usType;
ULONG cbSize;
ULONG offNext;
USHORT cxDisplay;
USHORT cyDisplay;
BITMAPFILEHEADER2 bfh2;
} BITMAPARRAYFILEHEADER2;
typedef BITMAPARRAYFILEHEADER2 *PBITMAPARRAYFILEHEADER2;
The fields in BITMAPARRAYFILEHEADER and BITMAPARRAYFILEHEADER2 have these
meanings:
usType
Type of structure. This is:
BFT_BITMAPARRAY (X'4142' - 'BA' for BITMAPARRAYFILEHEADER or
BITMAPARRAYFILEHEADER2)
cbSize
Size of the BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2 structure in
bytes.
offNext
Offset of the next BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2
structure from the start of the file
cxDisplay, cyDisplay
pel dimensions of the device for which this version is intended (for example, 640 x
480 for VGA).
The device-independent version must be the first BITMAPARRAYFILEHEADER or
BITMAPARRAYFILEHEADER2 defined.
In the single-size format, the BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2
structure is not present. The definition consists of one or two BITMAPFILEHEADER or
BITMAPFILEHEADER2 structures.
The format of the BITMAPFILEHEADER and BITMAPFILEHEADER2 structure is :
typedef struct _BITMAPFILEHEADER { /* bfh */
USHORT usType;
ULONG cbSize;
SHORT xHotspot;
SHORT yHotspot;
ULONG offBits;
BITMAPINFOHEADER bmp;
} BITMAPFILEHEADER;
typedef BITMAPFILEHEADER *PBITMAPFILEHEADER;
typedef struct _BITMAPFILEHEADER2 { /* bfh2 */
USHORT usType;
ULONG cbSize;
SHORT xHotspot;
SHORT yHotspot;
ULONG offBits;
BITMAPINFOHEADER2 bmp2;
} BITMAPFILEHEADER2;
typedef BITMAPFILEHEADER2 *PBITMAPFILEHEADER2;
BITMAPINFOHEADER2 is a standard data type (see above, and also
BITMAPINFOHEADER2).
The fields in BITMAPFILEHEADER and BITMAPFILEHEADER2 have these meanings:
usType
Type of resource the file contains. The valid values are:
BFT_BMAP (X'4D42' - 'BM' for bit maps)
BFT_ICON (X'4349' - 'IC' for icons)
BFT_POINTER (X'5450' - 'PT' for pointers).
BFT_COLORICON (X'4943' - 'CI' for color icons).
BFT_COLORPOINTER (X'5043' - 'CP' for color pointers).
cbSize
Size of the BITMAPFILEHEADER or BITMAPFILEHEADER2 structure in bytes.
xHotspot, yHotspot
Coordinates of the hotspot for icons and pointers. This field is ignored for bit maps.
offBits
Offset in bytes to the beginning of the bit-map pel data in the file, from the start of
the definition.
For icons and pointers, the cy field in bmp is actually twice the pel height of the image
that appears on the screen. This is because these types actually contain two full
bit-map pel definitions. The first bit-map definition is the XOR mask, which contains
invert information (0 = no invert, 1 = invert) for the pointer or icon. The second is the
AND mask, which determines whether the pointer or the screen is shown (0 =
black/white, 1 = screen/inverse screen).
For color icons or pointers, there are two bit-maps involved: one that is black and white
and consists of an AND and an XOR mask, and one that is color that defines the color
content.
The cy field in the BITMAPINFOHEADER2 structure for the color bit-map must be the real
height, that is, half the value specified for the black and white bit-map. The cx fields
must be the same.
The following table shows how these two bit-maps are used for a color icon or pointer:
XOR AND COLOR
1 1 x Invert screen
0 0 x Use color x
0 1 x Transparency
1 0 x Use color x
For color icons or pointers, two BITMAPFILEHEADER or BITMAPFILEHEADER2 structures
are therefore required:
BITMAPFILEHEADER2 with usType BFT_COLORICON or BFT_COLORPOINTER
BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
Color table
BITMAPFILEHEADER2 with same usType
BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
Color table
**
bits for one bit-map
**
**
bits for other bit-map
**
The usType for the first BITMAPFILEHEADER2 is either BFT_COLORICON or
BFT_COLORPOINTER. This means that a second BITMAPFILEHEADER2 is present as
part of the definition of a color icon or pointer. The first BITMAPFILEHEADER2 structure
contains the information for the black and white AND and XOR masks, while the second
BITMAPFILEHEADER2 structure contains the information for the color part of the pointer
or icon.
BITMAPFILEHEADER and BITMAPINFOHEADER can occur in place of
BITMAPFILEHEADER2 and BITMAPINFOHEADER2 in this example.
For the multiple version format, the file is as follows:
BITMAPARRAYFILEHEADER2 for device-independent version
BITMAPFILEHEADER2 (part of BITMAPARRAYFILEHEADER2)
BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
Color table
BITMAPFILEHEADER2 )
BITMAPINFOHEADER2 ) only if this is a color icon or pointer
Color table )
BITMAPARRAYFILEHEADER2 for first device-dependent version
BITMAPFILEHEADER2 (part of BITMAPARRAYFILEHEADER2)
BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2)
Color table
BITMAPFILEHEADER2 )
BITMAPINFOHEADER2 ) only if this is a color icon or pointer
Color table )
Further BITMAPARRAYFILEHEADER2 groups occur here as required
for additional device-dependent versions
**
bits for one bit-map
**
**
bits for next bit-map
**
And so on for as many bit-maps as necessary.
As before, BITMAPARRAYFILEHEADER, BITMAPFILEHEADER and BITMAPINFOHEADER
can occur in place of BITMAPARRAYFILEHEADER2, BITMAPFILEHEADER2 and
BITMAPINFOHEADER2.
The pel data is stored in the bit map in the order that the coordinates appear on a
display screen. That is, the pel in the lower-left corner is the first in the bit map. Pels
are scanned to the right, and upward, from that position. The bits of the first pel are
stored, beginning with the most significant bits of the first byte. The data for pels in
each scan line is packed together tightly, but all scan lines are padded at the end, so
that each one begins on a ULONG boundary.