ImageGear for C and C++ on Windows v19.6 - Updated
1-bit Images
User Guide > Concepts > Understanding Bitmap Images > 1-bit Images

Images that contain only one bit per pixel can contain only two colors, since only two pixel values are possible: 0 and 1. The two colors for a 1-bit image are usually black and white, but if the image is to be displayed on an RGB device, the colors are determined by a table called a color palette. A color palette defines the color to be displayed for each possible pixel value. The following table demonstrates the color palette for a 1-bit image, which specifies black for pixel value 0 and white for pixel value 1:

BLUE GREEN RED Not Used
color 0 0 0 0 0
color 1 255 255 255 255

Each entry in a color palette is a 4-byte structure of type AT_RGBQUAD, in which the first three bytes are used to specify the intensities of blue, green, and red respectively, forming the color. The 4th byte is not used. (Note that the ordering in this structure is blue, green, red-not red, green, blue.) AT_RGBQUAD and all other structure types mentioned in this chapter are described in detail in the sections Core Component Data Types Reference and Core Component Structures Reference.

If instead you wanted to have pixel value 0 displayed as a medium yellow, and pixel value 1 as brightest red, you might use the following color palette (yellow is constructed of equal intensities of red and green, with no blue):

BLUE GREEN RED Not Used
color 0 0 128 128 0
color 1 0 0 255 0