L_VecConvertToEMF

Summary

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

Syntax

#include "ltvkrn.h"

L_LVKRN_API L_HENHMETAFILE L_VecConvertToEMF(hDC, pVector, pRect, uDPI)

Parameters

L_HDC hDC

Handle to the device context responsible for the conversion.

const pVECTORHANDLE pVector

Pointer to a vector handle that references the vector image to be converted.

const L_RECT *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.

L_UINT uDPI

Dots per inch that will be used in the conversion.

Returns

Value Meaning
!NULL A handle to the EMF.
NULL An error occurred.

Comments

This function allocates an EMF handle and copies the LEAD vector to the EMF.

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 EMF 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 EMF will have the same logical size as the printer, resulting in high image quality when printing the EMF file.

Required DLLs and Libraries

See Also

Functions

Example

This example loads a vector drawing,
converts it to an enhanced meta file and returns the handle to the EMF.

HENHMETAFILE VecConvertToEMFExample( 
   HWND hWnd, 
   L_TCHAR* pszFile, 
   L_INT* nRet) 
{ 
   VECTORHANDLE   TmpVector;  /* Vector handle for initial loading */ 
   HENHMETAFILE   hEMF;       /* Handle to enhanced meta file */ 
   HDC            hDC;        /* Load the drawing */ 
 
   *nRet = L_VecLoadFile ( pszFile, &TmpVector, NULL, NULL ); 
   if(*nRet != SUCCESS) 
      return NULL; 
 
   /* Convert to EMF */ 
   hDC = GetDC( hWnd ); 
   hEMF = L_VecConvertToEMF(hDC, &TmpVector, NULL, 96 ); 
   ReleaseDC( hWnd, hDC ); 
 
   if (hEMF != NULL) 
   { 
      /* Free the vector */ 
      *nRet = L_VecFree( &TmpVector ); 
 
      return hEMF; 
   } 
 
   *nRet = FAILURE; 
   return NULL; 
} 

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

LEADTOOLS Vector C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.