Skip to content

Latest commit

 

History

History
196 lines (130 loc) · 6.33 KB

nf-wingdi-createdibitmap.md

File metadata and controls

196 lines (130 loc) · 6.33 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:wingdi.CreateDIBitmap
CreateDIBitmap function (wingdi.h)
The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits.
CBM_INIT
CreateDIBitmap
CreateDIBitmap function [Windows GDI]
DIB_PAL_COLORS
DIB_RGB_COLORS
_win32_CreateDIBitmap
gdi.createdibitmap
wingdi/CreateDIBitmap
gdi\createdibitmap.htm
gdi
e9a5b525-a6b6-4309-9e53-69d274b85783
12/05/2018
CBM_INIT, CreateDIBitmap, CreateDIBitmap function [Windows GDI], DIB_PAL_COLORS, DIB_RGB_COLORS, _win32_CreateDIBitmap, gdi.createdibitmap, wingdi/CreateDIBitmap
wingdi.h
Windows.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Gdi32.lib
Gdi32.dll
Windows
19H1
CreateDIBitmap
wingdi/CreateDIBitmap
c++
APIRef
kbSyntax
DllExport
gdi32.dll
Ext-MS-Win-GDI-Draw-l1-1-1.dll
ext-ms-win-gdi-draw-l1-1-2.dll
Ext-MS-Win-GDI-Draw-L1-1-3.dll
GDI32Full.dll
CreateDIBitmap

CreateDIBitmap function

-description

The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits.

-parameters

-param hdc [in]

A handle to a device context.

-param pbmih [in]

A pointer to a bitmap information header structure, BITMAPV5HEADER.

If fdwInit is CBM_INIT, the function uses the bitmap information header structure to obtain the desired width and height of the bitmap as well as other information. Note that a positive value for the height indicates a bottom-up DIB while a negative value for the height indicates a top-down DIB. Calling CreateDIBitmap with fdwInit as CBM_INIT is equivalent to calling the CreateCompatibleBitmap function to create a DDB in the format of the device and then calling the SetDIBits function to translate the DIB bits to the DDB.

-param flInit [in]

Specifies how the system initializes the bitmap bits. The following value is defined.

Value Meaning
CBM_INIT
If this flag is set, the system uses the data pointed to by the lpbInit and lpbmi parameters to initialize the bitmap bits.

If this flag is clear, the data pointed to by those parameters is not used.

 

If fdwInit is zero, the system does not initialize the bitmap bits.

-param pjBits [in]

A pointer to an array of bytes containing the initial bitmap data. The format of the data depends on the biBitCount member of the BITMAPINFO structure to which the lpbmi parameter points.

-param pbmi [in]

A pointer to a BITMAPINFO structure that describes the dimensions and color format of the array pointed to by the lpbInit parameter.

-param iUsage [in]

Specifies whether the bmiColors member of the BITMAPINFO structure was initialized and, if so, whether bmiColors contains explicit red, green, blue (RGB) values or palette indexes. The fuUsage parameter must be one of the following values.

Value Meaning
DIB_PAL_COLORS
A color table is provided and consists of an array of 16-bit indexes into the logical palette of the device context into which the bitmap is to be selected.
DIB_RGB_COLORS
A color table is provided and contains literal RGB values.

-returns

If the function succeeds, the return value is a handle to the compatible bitmap.

If the function fails, the return value is NULL.

-remarks

The DDB that is created will be whatever bit depth your reference DC is. To create a bitmap that is of different bit depth, use CreateDIBSection.

For a device to reach optimal bitmap-drawing speed, specify fdwInit as CBM_INIT. Then, use the same color depth DIB as the video mode. When the video is running 4- or 8-bpp, use DIB_PAL_COLORS.

The CBM_CREATDIB flag for the fdwInit parameter is no longer supported.

When you no longer need the bitmap, call the DeleteObject function to delete it.

ICM: No color management is performed. The contents of the resulting bitmap are not color matched after the bitmap has been created.

-see-also

BITMAPINFO

BITMAPINFOHEADER

Bitmap Functions

Bitmaps Overview

CreateCompatibleBitmap

CreateDIBSection

DeleteObject

GetDeviceCaps

GetSystemPaletteEntries

SelectObject

SetDIBits