L_VecConvertToWMF

#include "lvkrn.h"

L_LVKRN_API L_HMETAFILE L_VecConvertToWMF(hDC, pVector, pRect, uDPI)

L_HDC hDC;

handle to the device context

const pVECTORHANDLE pVector;

pointer to a vector handle

const RECT *pRect;

bounding rectangle

L_UINT uDPI;

DPI value

Converts a LEAD Technologies vector handle into a Windows metafile (WMF). 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.

Parameter

Description

hDC

Handle to the device context responsible for the conversion.

pVector

Pointer to a vector handle.

pRect

Points to a RECT structure that specifies the dimensions (in .01-millimeter units) of the picture to be stored in the enhanced metafile. If this parameter is NULL, the vector toolkit computes the dimensions of the smallest rectangle that surrounds the vector drawing. The pRect parameter should be provided where possible.

uDPI

Dots per inch that will be used in the conversion.

Returns

!NULL

The handle to the WMF.

NULL

An error occurred.

Comments

This function allocates a WMF handle and copies the LEAD vector to the WMF.

If this function is called with pRect containing these values:

pRect->left = 0;   
pRect->top = 0;   
pRect->right = 1000;   
pRect->bottom = 1000; 

the vector drawing will be converted to an WMF file with logical size 0 to 10 mm. in width and height.

This is very helpful when printing. For example, determine the printers printable area in millimeters. Divide that value by 100 and pass the resulting value as the right and bottom members of the RECT structure. The resulting WMF will have the same logical size as the printer, resulting in high image quality when printing the WMF file.

Required DLLs and Libraries

LVKRN

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

See Also

Functions:

L_VecConvertFromWMF, L_VecConvertToEMF, L_VecConvertFromEMF

Example

This example loads a vector drawing, convert it to a meta file and returns the handle to the WMF

HMETAFILE VecConvertToWMFExample( 
HWND hWnd, 
L_TCHAR* pszFile, 
L_INT* nRet) 
{ 
   VECTORHANDLE TmpVector;     /* Vector handle for initial loading */ 
   HMETAFILE hWMF; 
   HDC hDC; 
   /* Load the drawing */ 
   *nRet = L_VecLoadFile ( pszFile, &TmpVector, NULL, NULL ); 
   if (*nRet != SUCCESS) 
      return NULL; 
   /* Convert to WMF */ 
   hDC = GetDC( hWnd ); 
   hWMF = L_VecConvertToWMF(hDC, &TmpVector, NULL, 96 ); 
   ReleaseDC( hWnd, hDC ); 
   if (hWMF != NULL) 
   { 
      /* Free the vector */ 
      *nRet = L_VecFree( &TmpVector ); 
      return hWMF; 
   } 
   *nRet = FAILURE; 
   return NULL; 
} 

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