Method CreateDIBSection
CreateDIBSection(nint, ref BITMAPINFO, uint, out nint, nint, uint)
Creates a device-independent bitmap (DIB) and returns a handle to the newly created DIB.
public static extern nint CreateDIBSection(nint hdc, ref MswUtils.NativeMethods.BITMAPINFO pbmi, uint iUsage, out nint ppvBits, nint hSection, uint dwOffset)
Parameters
hdcnintA handle to a device context. This parameter can be null if the DIB is not associated with a specific device context.
pbmiMswUtils.NativeMethods.BITMAPINFOA reference to a MswUtils.NativeMethods.BITMAPINFO structure that specifies the dimensions and color format of the DIB.
iUsageuintSpecifies whether the
pbmistructure contains RGB values or palette indices. UseDIB_RGB_COLORSfor RGB values orDIB_PAL_COLORSfor palette indices.ppvBitsnintWhen the function returns, this parameter receives a pointer to the location of the DIB's bit values.
hSectionnintA handle to a file mapping object that the DIB will use to store the bitmap. If this parameter is null, the DIB is created in memory.
dwOffsetuintThe offset from the beginning of the file mapping object referenced by
hSection. This value is ignored ifhSectionis null.
Returns
- nint
A handle to the newly created DIB, or Zero if the function fails. Call GetLastWin32Error() to retrieve extended error information.
Remarks
The CreateDIBSection(nint, ref BITMAPINFO, uint, out nint, nint, uint) function allows applications to directly
access the bits of the bitmap, which can improve performance for certain operations.
The caller is
responsible for releasing the DIB handle using the DeleteObject function
when it is no longer
needed.