DPI compensation effect
Use the DPI compensation effect to automatically adjust an input bitmap to match the DPI of the context. This is useful for situations where a bitmap is created or loaded at a different DPI than the screen.
The CLSID for this effect is CLSID_D2D1DpiCompensation.
Effect properties
Display name and index enumeration | Description |
---|---|
InterpolationMode D2D1_DPICOMPENSATION_PROP_INTERPOLATION_MODE |
The interpolation mode the effect uses to scale the image. The type is D2D1_DPICOMPENSATION_INTERPOLATION_MODE. The default value is D2D1_DPICOMPENSATION_INTERPOLATION_MODE_LINEAR . |
BorderMode D2D1_DPICOMPENSATION_PROP_BORDER_MODE |
The mode used to calculate the border of the image, soft or hard. See Border modes for more info. The type is D2D1_BORDER_MODE. The default value is D2D1_BORDER_MODE_SOFT. |
InputDpi D2D1_DPICOMPENSATION_PROP_INPUT_DPI |
The DPI of the input image. The type is FLOAT. The default value is 96.0f. |
Interpolation modes
Enumeration | Description |
---|---|
D2D1_DPICOMPENSATION_INTERPOLATION_MODE_NEAREST_NEIGHBOR | Samples the nearest single point and uses that. This mode uses less processing time, but outputs the lowest quality image. |
D2D1_DPICOMPENSATION_INTERPOLATION_MODE_LINEAR | Uses a four point sample and linear interpolation. This mode uses more processing time than the nearest neighbor mode, but outputs a higher quality image. |
D2D1_DPICOMPENSATION_INTERPOLATION_MODE_CUBIC | Uses a 16 sample cubic kernel for interpolation. This mode uses the most processing time, but outputs a higher quality image. |
D2D1_DPICOMPENSATION_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR | Uses 4 linear samples within a single pixel for good edge anti-aliasing. This mode is good for scaling down by small amounts on images with few pixels. |
D2D1_DPICOMPENSATION_INTERPOLATION_MODE_ANISOTROPIC | Uses anisotropic filtering to sample a pattern according to the transformed shape of the bitmap. |
D2D1_DPICOMPENSATION_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC | Uses a variable size high quality cubic kernel to perform a pre-downscale the image if downscaling is involved in the transform matrix. Then uses the cubic interpolation mode for the final output. |
Note
If you don't select a mode, the effect defaults to D2D1_DPICOMPENSTION_INTERPOLATION_MODE_LINEAR.
Border modes
Name | Description |
---|---|
D2D1_BORDER_MODE_SOFT | Pixels outside of the input boundaries are generated by the mirror border effect. |
D2D1_BORDER_MODE_HARD | Pixels outside of the input boundaries are transparent black. |
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps] |
Minimum supported server | Windows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps] |
Header | d2d1effects.h |
Library | d2d1.lib, dxguid.lib |
Related topics
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για