Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


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

© 2015 Microsoft