LChange::ChangeFromEMF

#include "ltwrappr.h"

static L_INT LChange::ChangeFromEMF(pLBitmap, uStructSize, hWmf, uWidth, uHeight)

LBitmapBase L_FAR * pLBitmap;

/* pointer to a bitmap object*/

L_UINT uStructSize

/* size in bytes, of the structure pointed to by pLBitmap */

HENHMETAFILE hWmf;

/* handle to the EMF to be changed */

L_UINT uWidth;

/* width */

L_UINT uHeight;

/* height */

Changes a Windows enhanced metafile (EMF) into a LEAD Technologies bitmap and, if successful, frees the enhanced metafile. 

Parameter

Description

pLBitmap

Pointer to the bitmap object to be updated with the changed file.

uStructSize

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

hWmf

Handle to the EMF to be changed.

uWidth

Amount by which to scale the enhanced metafile’s original width.

UHeight

Amount by which to scale the enhanced metafile’s original height.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

If this function is successful, hWmf is freed.

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

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.

See Also

Functions:

Class Members, LChange::ChangeToEMF, LChange::ChangeFromWMF, LChange::ChangeToWMF, LBitmapBase::ConvertFromEMF, LBitmapBase::ConvertFromWMF, 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 EMF, then converts
   the EMF back to a bitmap 
*/

void ChangeEMFToLead(LBitmap * pLeadBitmap)
{
   LBitmap Bitmap;    /* Bitmap handle for the initial image */
   HENHMETAFILE   hEMF; 

   /* Load a bitmap, keeping its own bits per pixel */
   Bitmap.Load(TEXT("image3.cmp"), 0, ORDER_BGR, NULL, NULL); 

   /* Convert the initial bitmap to a EMF */
   hEMF = LChange::ChangeToEMF( &Bitmap ); 

   /* Convert the EMF to create a new LEAD bitmap and preserve the size */
   LChange::ChangeFromEMF(pLeadBitmap, sizeof(BITMAPHANDLE), hEMF, 0, 0); 
}