Creates a CImage bitmap and attach it to the previously constructed CImage object.

BOOL Create(
   int nWidth,
   int nHeight,
   int nBPP,
   DWORD dwFlags = 0 
) throw( );


The width of the CImage bitmap, in pixels.


The height of the CImage bitmap, in pixels. If nHeight is positive, the bitmap is a bottom-up DIB and its origin is the lower left corner. If nHeight is negative, the bitmap is a top-down DIB and its origin is the upper left corner.


The numbers of bits per pixel in the bitmap. Usually 4, 8, 16, 24, or 32. Can be 1 for monochrome bitmaps or masks.


Specifies if the bitmap object has an alpha channel. Can be a combination of zero or more of the following values:

  • createAlphaChannel   Can only be used if nBPP is 32. If specified, the created image has an alpha (transparency) value for each pixel, stored in the 4th byte of each pixel (unused in a non-alpha 32-bit image). This alpha channel is automatically used when calling CImage::AlphaBlend.


In calls to CImage::Draw, images with an alpha channel are automatically alpha blended to the destination.

Nonzero if successful; otherwise 0.

Header: atlimage.h

Community Additions