Sets the DPI (dots per inch) value that LEADTOOLS uses when loading WMF/EMF files.
#include "ltwrappr.h"
static L_INT LFileSettings::SetWMFResolution (nXResolution=0, nYResolution=0)
Value that represents the horizontal resolution that LEADTOOLS uses when loading images from WMF files. Possible values are:
Value | Meaning |
---|---|
0 | Load the file at the resolution present in the file. This is the default value. This is the default value. |
Any positive value | Load the file at the corresponding DPI. For example, if this value is 150, load the image at 150 DPI. |
Value that represents the vertical resolution that LEADTOOLS uses when loading images from WMF files. Possible values are:
Value | Meaning |
---|---|
0 | Load the file at the resolution present in the file. This is the default value. This is the default value. |
Any positive value | Load the file at the corresponding DPI. For example, if this value is 150, load the image at 150 DPI. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The values that this function sets are valid for the current thread, and you can change the values in the thread only by calling this function again.
The WMF files can contain vectored graphics or raster images. LEADTOOLS can load either type, but can save only raster images. The issue of image resolution rises mainly when loading vectored graphics.
LEADTOOLS loads a WMF/EMF file by creating a temporary device context (DC), drawing the vectored graphics (or painting the raster image) in the device context, and converting the resulting device context to a bitmap. Loading an image at some smaller DPI values may yield an image that is smaller, and less detailed, than the original, or, since bitmaps use more memory than vectored graphics, it may yield an image that is too large to handle efficiently.
You can use LFileSettings::GetWMFResolution and LFileSettings::SetWMFResolution functions, along with the LFile::GetInfo or LMemoryFile::GetInfo function, to manage these image size issues. The following are examples of how you can use these functions:
To load an image at its saved resolution, you can do the following:
To load an image that will fit a predetermined width (such as the width of your application's client area), you can do the following:
Some WMF/EMF files contain viewport information, which requires a device context of a particular size. LEADTOOLS always loads these files using the resolution specified in the file. In this case, the value specified by LFileSettings::SetWMFResolution function has no effect.
Notes
Win32, x64.
L_INT LFileSettings__SetWMFResolutionExample()
{
L_INT nRet;
//...
LFileSettings fileSettings;
nRet = fileSettings.SetWMFResolution(150,0);
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document