L_ConvertFromWMF2

#include "l_bitmap.h"

L_LTDIS_API L_INT L_ConvertFromWMF2(pBitmap, uStructSize, hWmf, uWidth, uHeight, clrBackground)

pBITMAPHANDLE pBitmap;

pointer to a bitmap

L_UINT uStructSize;

size in bytes, of the structure pointed to by pBitmap

L_HMETAFILE hWmf;

handle to the WMF to be converted

L_UINT uWidth;

width

L_UINT uHeight;

height

L_COLORREF clrBackground;

background

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

pBitmap

Pointer to the bitmap to be updated with the converted file.

uStructSize

Size in bytes, of the structure pointed to by pBitmap, for versioning. Use sizeof(BITMAPHANDLE).

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.

clrBackground

Specifies the color used to fill the background.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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 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:

L_ChangeFromEMF, L_ChangeFromWMF

 

L_ChangeToEMF, L_ChangeToWMF,

 

L_ConvertFromEMF, L_ConvertToWMF,

 

L_ConvertToEMF

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT ConvertFromWMF2Example(L_VOID) 
{ 
   L_INT nRet; 
   //BITMAPHANDLE   LeadBitmap;    /* Bitmap handle for the initial image */ //Motasem: Uncomment this line, and remove this comment 
   BITMAPHANDLE   Bitmap;    /* 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")), &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Convert the initial bitmap to a WMF */ 
   hWmf  = L_ConvertToWMF( &Bitmap ); 
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &Bitmap, FILE_BMP, 24, 0, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Free the initial bitmap */ 
   if(Bitmap.Flags.Allocated) 
      L_FreeBitmap(&Bitmap); 
   //nRet = L_ConvertFromWMF2(&LeadBitmap, sizeof(BITMAPHANDLE), hWmf, 0, 0, (20,30,15));//Motasem: unresolved external symbol _L_ConvertFromEMF2@24 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Clean up */ 
   DeleteMetaFile(hWmf); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help