#include "l_bitmap.h"
L_LTDIS_API L_INT L_ChangeFromWMF(pBitmap, uStructSize, hWmf, uWidth, uHeight)
Changes a Windows metafile (WMF) into a LEAD Technologies bitmap and, if successful, frees the metafile.
Pointer to the bitmap to be updated with the changed file.
Size in bytes, of the structure pointed to by pBitmap
, for versioning. Use sizeof(BITMAPHANDLE).
Handle to the WMF to be changed.
Amount by which to scale the metafiles original width.
Amount by which to scale the metafiles original height.
Value | Meaning |
---|---|
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.
If this function is successful, hWmf
is freed.
The metafile can be loaded at the original dimension or scaled by using the uWidth
and uHeight
parameters.
If uWidth == 0 and uHeight == 0 - the metafile is loaded at the size present in the file
If uWidth == 0 and uHeight > 0 - the metafile is stretched so that it has the height uHeight (preserving the aspect ratio)
If uWidth > 0 and uHeight == 0 - the metafile is stretched so that it has the width uWidth (preserving the aspect ratio)
If uWidth > 0 and uHeight > 0 - the metafile is stretched so that it has the width uWidth and height uHeight (the aspect ratio is ignored)
Required DLLs and Libraries
Win32, x64.
This example loads a bitmap, converts it to a WMF, then converts
the WMF back to a bitmap
Note that in this example, we didn't have to free the bitmap and the metafile,
like we did in ChangeWMFToLead
L_INT ChangeFromWMFExample()
{
L_INT nRet;
BITMAPHANDLE LeadBitmap; /* Bitmap handle for the initial image */
HMETAFILE hWmf;
/* Load a bitmap, keeping its own bits per pixel */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if(nRet != SUCCESS)
return nRet;
/* Convert the initial bitmap to a WMF */
hWmf = L_ChangeToWMF( &LeadBitmap);
/* Convert the WMF to create a new LEAD bitmap and preserve the size */
nRet = L_ChangeFromWMF(&LeadBitmap, sizeof(BITMAPHANDLE), hWmf, 0, 0);
if(nRet != SUCCESS)
return nRet;
nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL);
if(nRet != SUCCESS)
return nRet;
if(LeadBitmap.Flags.Allocated)
L_FreeBitmap(&LeadBitmap);
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