static L_INT LChange::ChangeFromDDB(hDC, uStructSize, pLBitmap, hBitmap, hPalette)
Changes a Windows device dependent bitmap (DDB) to a LEAD bitmap. The new LEAD bitmap is stored in the specified LBitmapBase object's internal LEAD bitmap handle. This function results in only one copy of the bitmap, and it invalidates the DDB handle.
Handle to the device responsible for the conversion. The mapping mode of the device context must be MM_TEXT.
Size in bytes, of the structure pointed to by pLBitmap. Use sizeof(BITMAPHANDLE).
Address of the LEAD bitmap object.
Handle to the DDB to be changed.
Handle to the palette. This value can be NULL if the hDC parameter refers to a device that is greater than 8 bits, or if the bitmap will use the system palette.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
After calling this function, the class object's internal LEAD bitmap handle will point to the previous DDB data.
Win32, x64.
L_INT LChange__ChangeFromDDBExample()
{
L_INT nRet;
LBitmapBase Bitmap;
HBITMAP hBitmap;
HDC hDC;
hDC=GetDC(NULL);
nRet = Bitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")));
if(nRet != SUCCESS)
return nRet;
hBitmap=LChange::ChangeToDDB(hDC,&Bitmap);
if(hBitmap)
LBase::DisplayError(NULL,TEXT("Successful converting from LEAD Bitmap to DDB Bitmap"));
nRet = Bitmap.Free();
if(hBitmap)
{
nRet = LChange::ChangeFromDDB(hDC,&Bitmap, sizeof(BITMAPHANDLE),hBitmap,NULL);
if(nRet != SUCCESS)
return nRet;
if(Bitmap.IsAllocated())
{
LBase::DisplayError(NULL,TEXT("Successful converting DDB Bitmap to LEAD Bitmap"));
}
else
LBase::DisplayErrorFromList(NULL);
ReleaseDC(NULL,hDC);
}
else
LBase::DisplayError(NULL,TEXT("Cannot Load Bitmap from resource"));
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