#include "l_bitmap.h"
L_LTDIS_API L_INT L_ChangeFromEMF2(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_HENHMETAFILE hWmf; |
handle to the EMF to be changed |
L_UINT uWidth; |
width |
L_UINT uHeight; |
height |
L_COLORREF clrBackground; |
background |
Changes a Windows enhanced metafile (EMF) into a LEAD Technologies bitmap and, if successful, frees the enhanced 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 EMF to be changed. |
uWidth |
Amount by which to scale the enhanced metafiles original width. |
uHeight |
Amount by which to scale the enhanced metafiles original height. |
clrBackground |
Specifies the color used to fill the background. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
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.
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
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
Functions: |
|
|
|
|
|
|
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT ChangeFromEMF2Example(L_VOID)
{
L_INT nRet;
BITMAPHANDLE LeadBitmap; /* Bitmap handle for the initial image */
/* Load a bitmap, keeping its own bits per pixel */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if(nRet != SUCCESS)
return nRet;
HENHMETAFILE hEMF;
/* Convert the initial bitmap to a EMF */
hEMF = L_ChangeToEMF( &LeadBitmap );
/* Convert the EMF to create a new LEAD bitmap and preserve the size */
//nRet = L_ChangeFromEMF2(&LeadBitmap, sizeof(BITMAPHANDLE), hEMF, 0, 0, (20,30,15)); //Motasem: unresolved external symbol _L_ChangeFromEMF2@24
if(nRet != SUCCESS)
return nRet;
nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL);
if(nRet != SUCCESS)
return nRet;
/* Free the initial bitmap */
if(LeadBitmap.Flags.Allocated)
L_FreeBitmap(&LeadBitmap);
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET