Bitmap::Bitmap(INT,INT,INT,PixelFormat,BYTE*) method (gdiplusheaders.h)

Creates a Bitmap::Bitmap object based on an array of bytes along with size and format information.


void Bitmap(
  [in] INT         width,
  [in] INT         height,
  [in] INT         stride,
  [in] PixelFormat format,
  [in] BYTE        *scan0


[in] width

Type: INT

Integer that specifies the width, in pixels, of the bitmap.

[in] height

Type: INT

Integer that specifies the height, in pixels, of the bitmap.

[in] stride

Type: INT

Integer that specifies the byte offset between the beginning of one scan line and the next. This is usually (but not necessarily) the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) multiplied by the width of the bitmap. The value passed to this parameter must be a multiple of four.

[in] format

Type: PixelFormat

Integer that specifies the pixel format of the bitmap. The PixelFormat data type and constants that represent various pixel formats are defined in Gdipluspixelformats.h. For more information about pixel format constants, see Image Pixel Format Constants.

[in] scan0

Type: BYTE*

Pointer to an array of bytes that contains the pixel data. The caller is responsible for allocating and freeing the block of memory pointed to by this parameter.

Return value



Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusheaders.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also


Bitmap Constructors


Image Pixel Format Constants

Images, Bitmaps, and Metafiles

Using Images, Bitmaps, and Metafiles