One of the major features of WPF is resolution independence. All visual objects are positioned and measured using device independent coordinates. This is different from GDI+ and Silverlight environments, which measure graphic objects in pixels.
WPF defines one device independent unit as 1/96th of an inch. One unit maps to one pixel if the system uses 96 dpi display setting (Windows Small Fonts).
Most of ImageGear display API supports both GDI+ and WPF. However, the ImageGear term "Device Coordinates" has different meaning in GDI+ and WPF. In GDI+, device coordinates are pixels, and in WPF they are WPF device independent units, rounded to an integer.
This affects the following API:
API Name | Usage in GDI+ | Usage in WPF |
IImGearLayout Interface.ClipRect Property | Expressed in pixels. | Expressed in WPF device independent units. |
IImGearLayout Interface.DeviceRect Property | Expressed in pixels. | Expressed in WPF device independent units. |
ImGearFitModes Enumeration.ACTUAL_SIZE | Displayed image size in pixels is equal to image size in pixels. | Displayed image size, in WPF device independent units, is equal to image size in pixels. |
ImGearPresentationPageDisplay.ConvertCoordinates Method | Device coordinates are expressed in pixels. | Device coordinates are expressed in WPF device independent units. |
ImGearPageDisplay.ZoomToRectangle Method | Device rectangle coordinates are expressed in pixels. | Device rectangle coordinates are expressed in WPF device independent units. |
ImGearARTPage.ConvertCoordinates Method | Device coordinates are expressed in pixels. | Device coordinates are expressed in WPF device independent units. |
ImageGear renders images according to the specified device dimensions. In WPF, device dimensions are specified in device-independent units. If an end user uses the standard Windows display resolution of 96 DPI ("Small Fonts"), one device independent unit maps exactly to one pixel. In other words, if you set the device rectangle to 100x100, then the size of the ImageGear rendered image will be 100x100 pixels, and the image will occupy an area of 100x100 pixels on the screen.
If the display resolution is different from the default 96 DPI, or when printing an image, the device independent units do not map exactly to device units. For example, if you set the device rectangle to 100x100, and print on a 600 DPI printer, the size of the ImageGear rendered image will still be 100x100 pixels, but the WPF engine will stretch it onto a 625x625 pixel area on the printer (100 / 96 * 600 = 625). This may result in a blurry, low-resolution appearance.
ImageGear provides two ways to avoid this scaling issue: