L_LTDIS_API L_INT L_ConvertFromEMF2(pBitmap, uStructSize, hWmf, uWidth, uHeight, clrBackground)
Converts a Windows enhanced metafile (EMF) into a LEAD Technologies bitmap. When this function is completed, there are two copies of the drawing in memory: the EMF and the original LEAD vector.
Freeing one will not affect the other.
Pointer to the bitmap to be updated with the converted file.
Size in bytes, of the structure pointed to by
pBitmap, for versioning. Use sizeof(BITMAPHANDLE).
Handle to the EMF to be converted.
Amount by which to scale the metafiles original width.
Amount by which to scale the metafiles original height.
The background color. The standard Windows values for COLORREF represent either red, green, and blue color values, or an index into the bitmap's palette. A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value. If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette which holds the color value. These COLORREF values can be used with any Windows function and macro that takes a COLORREF parameter.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
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.
The enhanced metafile can be loaded at the original dimension or scaled by using the
If uWidth == 0 and uHeight == 0 - the enhanced metafile is loaded at the size present in the file
If uWidth == 0 and uHeight > 0 - the enhanced metafile is stretched so that it has the height uHeight (preserving the aspect ratio)
If uWidth > 0 and uHeight == 0 - the enhanced metafile is stretched so that it has the width uWidth (preserving the aspect ratio)
If uWidth > 0 and uHeight > 0 - the enhanced metafile is stretched so that it has the width uWidth and height uHeight (the aspect ratio is ignored)
Required DLLs and Libraries
This example loads a bitmap, converts it to a EMF, then converts
the EMF back to a bitmap
L_INT ConvertFromEMF2Example(pBITMAPHANDLE pLeadBitmap)
BITMAPHANDLE Bitmap; /* Bitmap handle for the initial image */
/* Load a bitmap, keeping its own bits per pixel */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if(nRet != SUCCESS)
/* Convert the initial bitmap to a EMF */
hEMF = L_ConvertToEMF( &Bitmap );
nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &Bitmap, FILE_BMP, 24, 0, NULL);
if(nRet != SUCCESS)
/* Free the initial bitmap */
/* Convert the EMF to create a new LEAD bitmap and preserve the size */
L_ConvertFromEMF2(pLeadBitmap, sizeof(BITMAPHANDLE), hEMF, 0, 0, RGB(255,0,0)); // use Red for background color
/* Clean up */
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries