L_ChangeFromWMF

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_ChangeFromWMF(pBitmap, uStructSize, hWmf, uWidth, uHeight)

pBITMAPHANDLE pBitmap;

/* pointer to a bitmap */

L_UINT uStructSize;

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

HMETAFILE hWmf;

/* handle to the WMF to be converted */

L_UINT uWidth;

/* width */

L_UINT uHeight;

/* height */

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

Parameter

Description

pBitmap

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

uStructSize

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

hWMF

Handle to the WMF to be changed.

uWidth

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

UHeight

Amount by which to scale the 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 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

Windows 95 / 98 / Me, Windows 2000 / XP.

See Also

Functions:

L_ChangeToEMF, L_ChangeFromEMF,

 

L_ChangeToWMF, L_ConvertFromEMF,

 

L_ConvertFromWMF, L_ConvertToWMF,

 

L_ConvertToEMF

Example

/* This example loads a bitmap, converts it to a WMF, then converts
   the WMF back to a bitmap 
   Note that in this example, we didn't have to free the bitmap and the metafile, 
   like we did in ChangeWMFToLead
*/

void ChangeWMFToLead(HWND hWnd, pBITMAPHANDLE pLeadBitmap)
{
   BITMAPHANDLE Bitmap;    /* Bitmap handle for the initial image */
   HMETAFILE   hWmf;

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

   /* Convert the initial bitmap to a WMF */
   hWmf = L_ChangeToWMF( &Bitmap );

   /* Convert the WMF to create a new LEAD bitmap and preserve the size */
   L_ChangeFromWMF(pLeadBitmap, sizeof(BITMAPHANDLE), hWmf, 0, 0);
}