Freigeben über


ComputeFlatteningTolerance function

Computes the appropriate flattening tolerance to pass to APIs that take a flattening tolerance (for instance, ID2D1DeviceContext1::CreateFilledGeometryRealization).

Syntax

FLOAT ComputeFlatteningTolerance(
  _In_ const D2D1_MATRIX_3X2_F &matrix,
             FLOAT             dpiX,
             FLOAT             dpiY,
             FLOAT             maxZoomFactor
);

Parameters

  • matrix [in, ref]
    The matrix that will be applied subsequently to the geometry being flattened.

  • dpiX
    Default: 96.0f

    The horizontal DPI of the render target that the geometry will be rendered onto (a choice of 96 implies no DPI correction).

  • dpiY
    Default: 96.0f

    The vertical DPI of the render target that the geometry will be rendered onto (a choice of 96 implies no DPI correction).

  • maxZoomFactor
    Default: 1.0f

    The maximum amount of additional scaling (on top of any scaling implied by the matrix or the DPI) that will be applied to the geometry.

Return value

The flattening tolerance.

Remarks

Flattening tolerances affect how finely curved segments such as arcs and Beziers will be tessellated. When rendering a geometry realization or the output of a geometry operation with the identity transform, the default flattening tolerance (D2D1_DEFAULT_FLATTENING_TOLERANCE) is appropriate. Using the default tolerance with a large scale transform, however, can cause visible faceting. To guard against this, callers should use ComputeFlatteningTolerance and pass in the expected transform that the content will be rendered with and the DPI of the render target the content will be rendered onto.

Note   The DPI is used only to infer the corresponding scale transform. No attempt is made to validate dpi values (e.g. ensure they are positive).

 

In some scenarios content may be dynamically resized. In this case, the caller may wish to realize the geometry at a higher zoom level than is currently required. This can be achieved by passing in a maxZoomFactor equal to or greater than the maximum scale the geometry will be rendered at. Note that the maxZoomFactor is appended to any scale that may be present in the matrix parameter.

Requirements

Minimum supported client

Windows 8.1 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2012 R2 [desktop apps | UWP apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Header

D2d1_1.h

Library

D2d1.lib

DLL

D2d1.dll