Microsoft Windows CE 3.0  

Using Bitmaps

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

A bitmap is an array of bits that creates an image when it is mapped to a rectangular pixel array on an output device. Windows CE supports device-independent bitmaps (DIBs). A DIB has its own color table and can be displayed on a variety of devices. Most graphics information is stored in DIB format.

The data needed to draw a DIB is stored in a BITMAPINFOstructure, which consists of a BITMAPINFOHEADERstructure and an array of two or more RGBQUADstructures. BITMAPINFOHEADERcontains information about the dimensions and color format of the DIB. Each RGBQUADstructure defines one of the colors used by the bitmap. The array of RGBQUADstructures is called a color table.

Windows CE supports bitmaps with pixel depths of 1, 4, 8, 16, 24, or 32 bits per pixel (bpp). It does not support compressed bitmap formats, such as run-length encoded bitmaps.

Bitmaps of 1, 4, and 8 bpp are palettized, and BITMAPINFOincludes a color table of the length implied by the biBitCountmember of BITMAPINFOHEADER. For non-palettized images of 16 or 32 bpp, the color table contains three entries that specify the red, green, and blue intensities. The 24-bpp bitmaps do not use a color table; each image pixel is in RGB format.

To store a DIB in memory

  1. Call the CreateCompatibleDCfunction to create a memory DC that is compatible with the specified device. The DC contains a read-only single-pixel monochrome bitmap.
  2. Use the LoadBitmapor the LoadImagefunction to load a bitmap.
  3. Select the bitmap into the DC by calling the SelectObjectfunction. The default bitmap is then replaced with a reference to the loaded bitmap.

    To transfer the DIB to a DirectDraw surface

    1. Call the IDirectDrawSurface5::GetDCmethod to get the target DC.
    2. Call the BitBltfunction to transfer the color data from the GDI DC to the DirectDraw DC.
      Note   Because arbitrary formats are supported, you can perform a bit block transfer (blit) between bitmaps with different pixel depths. Windows CE automatically translates source pixels to the nearest matching color that can be represented in the target format.

      Related Topics

      Working with DirectDraw Surfaces



       Last updated on Tuesday, May 18, 2004

      © 2004 Microsoft Corporation. All rights reserved.