LBitmapBase::ConvertFromEMF

#include "ltwrappr.h"

virtual L_INT LBitmapBase::ConvertFromEMF(hEMF, uWidth, uHeight)

Converts a Windows enhanced metafile (WMF) 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.

Parameters

HENHMETAFILE hEMF

Handle to the EMF to be converted.

L_UINT uWidth

Amount by which to scale the metafiles original width.

L_UINT uHeight

Amount by which to scale the metafiles original height.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

The enhanced metafile can be loaded at the original dimension or scaled by using the uWidth and uHeight parameters.

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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example loads a bitmap, converts it to a EMF, then converts
the EMF back to a bitmap

L_INT LBitmapBase__ConvertFromEMFExample(LBitmap *pLeadBitmap)  
{ 
   L_INT nRet; 
   LBitmap Bitmap;    /* Bitmap handle for the initial image */ 
   HENHMETAFILE   hEMF;  
 
   /* Load a bitmap, keeping its own bits per pixel */ 
   Bitmap.Load(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), 0, ORDER_BGR, NULL, NULL);  
   /* Convert the initial bitmap to a EMF */ 
   hEMF = Bitmap.ConvertToEMF(); 
   /* Free the initial bitmap */ 
   nRet =Bitmap.Free(); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   /* Convert the EMF to create a new LEAD bitmap and preserve the size */ 
   nRet =pLeadBitmap->ConvertFromEMF(hEMF, 0, 0); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   /* Clean up */ 
   DeleteEnhMetaFile(hEMF);  
 
   return SUCCESS; 
} 

Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.