Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Raster imaging C++ Class library help

LBitmapBase::ConvertFromWMF

Show in webframe

#include "ltwrappr.h"

virtual L_INT LBitmapBase::ConvertFromWMF(hWMF, uWidth, uHeight)

HMETAFILE hWMF;

/* handle to the WMF to be converted */

L_UINT uWidth;

/* width */

L_UINT uHeight;

/* height */

Converts a Windows metafile (WMF) into a LEAD Technologies bitmap. When this function is completed, there are two copies of the drawing in memory: the WMF and the original LEAD vector. Freeing one will not affect the other.

Parameter

Description

hWMF

Handle to the WMF to be converted.

uWidth

Amount by which to scale the metafiles original width.

uHeight

Amount by which to scale the metafiles original height.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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

LTKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

Class Members, LChange::ChangeFromEMF, LChange::ChangeFromWMF,

 

LChange::ChangeToEMF, LChange::ChangeToWMF,

 

LBitmapBase::ConvertFromEMF, LBitmapBase::ConvertToWMF,

 

LBitmapBase::ConvertToEMF

Topics:

Raster Image Functions: Input and Output
Loading and Saving Images

Example

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

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmapBase__ConvertFromWMFExample(HWND hWnd, LBitmap* pLeadBitmap) 
{
   UNREFERENCED_PARAMETER(hWnd);
   L_INT nRet;
   LBitmap Bitmap;    /* Bitmap handle for the initial image */
   HMETAFILE   hWmf; 
   /* Load a bitmap, keeping its own bits per pixel */
   nRet =Bitmap.Load(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), 0, ORDER_BGR, NULL, NULL);
   if(nRet !=SUCCESS)
      return nRet;
   /* Convert the initial bitmap to a WMF */
   hWmf = Bitmap.ConvertToWMF( ); 
   /* Free the initial bitmap */
   nRet =Bitmap.Free();
   if(nRet !=SUCCESS)
      return nRet;
   /* Convert the WMF to create a new LEAD bitmap and preserve the size */
   nRet =pLeadBitmap->ConvertFromWMF(hWmf, 0, 0);
   if(nRet !=SUCCESS)
      return nRet;
   /* Clean up */
   DeleteMetaFile(hWmf); 
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.