Creating and Loading a Custom Bit Map
An application can create a custom bit map by setting the bits in an array
and passing the array to GpiCreateBitmap
or by running the Icon Editor and loading the bit map with GpiLoadBitmap.
To create a custom bit map with an array, an application:
- Defines an array of bytes that will set pels
in an image to the appropriate colors. This array of bytes typically represents
the output of a scanned image.
- Sets the fields in the BITMAPINFOHEADER
to their appropriate values.
- Sets the fields in the BITMAPINFO2
structure to their appropriate values.
- Calls GpiCreateBitmap,
passes it the addresses of the structures and the array of bytes that the
application has already defined, and sets the flOptions parameter to CBM_INIT.
If the application is to use this bit map as a fill pattern, it assigns
the bit map a local identifier by calling GpiSetBitmapId.
To load a custom bit map that was created with the Icon Editor:
- Copy the bit map file to the directory in which
you compile your application.
- Create a BITMAP entry in your application's resource
file, assigning a unique integer identifier to the bit map.
- Call GpiLoadBitmap,
passing it the identifier that you assigned to the bit map in the resource
file.
An application can use GpiLoadBitmap
to load any bit map from a file that conforms to any of the standard
OS/2 bit-map formats or to a device-specific format supported by the device
concerned. This means that an application can load a bit map created by
another application, if that application created the correct bit-map header
and stored the bit-map bits correctly.
[Back: Using the Icon Editor]
[Next: Storing Color Information in a Bit Map]