Available in the LEADTOOLS Imaging toolkit. |
WMFResolution property (Main Control)
Visual
Basic example
Visual
C++ 4.0 example
Syntax long WMFResolution
Overview: Refer to Loading a Bitmap from a File.
Remarks
Sets the DPI (dots per inch) value that LEADTOOLS uses when loading WMF files. A value of 0 results in the resolution present in the file being loaded. A positive value results in the image being loaded at the corresponding DPI. By default, the value is 0.
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 arises mainly when loading vectored graphics.
LEADTOOLS loads a WMF 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 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 InfoXRes property and WMFResolution, along with GetFileInfo, to manage these image size issues. The following are examples of how you can use these methods:
To load an image at its saved resolution, you can do the following:
1. Set WMFResolution to 0.
2. Call Load method to load the file.
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:
1. Set WMFResolution to 0.
2. Call GetFileInfo and check InfoXRes property and InfoWidth property, to determine the resolution and size of the image stored in the file.
3. Calculate the necessary resolution to get the desired width. Where the necessary resolution is A, the value from InfoXRes property is B, the desired width is C, and the value of the Width field is D, the calculation is as follows: A = B * C / D.
4. Set WMFResolution to the desired resolution.
5. Call Load to load the file.
Some WMF 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 WMFResolution has no effect.
Note: When saving WMF files, LEADTOOLS saves the current resolution value in the file.
See Also
Elements: GetFileInfo method, InfoXRes property, InfoYRes property, Load method, LoadMemory method, LoadStamp method