static HGLOBAL LChange::ChangeToDIB(pLBitmap,uType= DIB_BITMAPV5HEADER)
Changes an LBitmapBase object's internal LEAD bitmap handle to a Windows Device Independent Bitmap (DIB). This function results in only one copy of the bitmap, and it invalidates the LEAD bitmap handle.
Pointer to a LEAD bitmap object referencing the bitmap to change.
Flag that indicates the type of DIB to be created. Possible values are:
Value | Meaning |
---|---|
DIB_BITMAPINFOHEADER | [0] DIB that uses a BITMAPINFOHEADER |
DIB_BITMAPV4HEADER | [1] DIB that uses a BITMAPV4HEADER. (Introduced in Windows 95 and Windows NT 4.0) |
DIB_BITMAPV5HEADER | [2] DIB that uses a BITMAPV5HEADER (Introduced in Windows 2000 and Windows 98). This is the default value. |
Value | Meaning |
---|---|
>0 | Global memory handle to DIB. |
0 | An error occurred. |
The orientation of the image and color order will depend on how the image was loaded into the LEAD bitmap.
A DIB consists of one of the following:
a BITMAPFILEHEADER,
a BITMAPV4HEADER (introduced in Windows 95 and Windows NT 4.0),
a BITMAPV5HEADER (introduced in Windows 2000 and Windows 98),
followed by a color table and then the bitmap data. The resulting DIB type is determined by the value of the uType flag.
When you no longer need the DIB, you can free it using the Windows GlobalFree() function.
This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.
Win32, x64.
L_INT LChange__ChangeToDIBExample()
{
L_INT nRet;
LBitmapBase MyBitmap;
HGLOBAL hDib;
nRet = MyBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")));
if(nRet != SUCCESS)
return nRet;
if(MyBitmap.IsAllocated())
{
hDib=LChange::ChangeToDIB(&MyBitmap);
if(hDib!=0)
{
LBase::DisplayError(NULL,TEXT("Successful converting LEAD Bitmap to DIB Bitmap"));
MyBitmap.Free();
nRet = LChange::ChangeFromDIB(&MyBitmap, sizeof(BITMAPHANDLE), hDib);
if(nRet != SUCCESS)
return nRet;
else
LBase::DisplayError(NULL,TEXT("Successful converting from DIB Bitmap to LEAD bitmap"));
}
else
LBase::DisplayErrorFromList(NULL);
}
else
LBase::DisplayError(NULL,TEXT("Cannot Load Bitmap"));
//...
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document