ID2D1Geometry::ComputeLength methods

Calculates the length of the geometry as though each segment were unrolled into a line.

Overload list

Method Description
ComputeLength(D2D1_MATRIX_3X2_F&,FLOAT*) Calculates the length of the geometry as though each segment were unrolled into a line.
ComputeLength(D2D1_MATRIX_3X2_F*,FLOAT*) Calculates the length of the geometry as though each segment were unrolled into a line.
ComputeLength(D2D1_MATRIX_3X2_F&,FLOAT,FLOAT*) Calculates the length of the geometry as though each segment were unrolled into a line.
ComputeLength(D2D1_MATRIX_3X2_F*,FLOAT,FLOAT*) Calculates the length of the geometry as though each segment were unrolled into a line.

Examples

The following code shows how to use ComputeLength to compute the length of a specified path geometry.

float length = 0;
hr = m_pPathGeometry->ComputeLength(
    NULL, //no transform
    &length
    );

if (SUCCEEDED(hr))
{
    m_Animation.SetStart(0);        //start at beginning of path
    m_Animation.SetEnd(length);     //length at end of path
    m_Animation.SetDuration(5.0f);  //seconds

    ZeroMemory(&m_DwmTimingInfo, sizeof(m_DwmTimingInfo));
    m_DwmTimingInfo.cbSize = sizeof(m_DwmTimingInfo);

    // Get the composition refresh rate. If the DWM isn't running,
    // get the refresh rate from GDI -- probably going to be 60Hz
    if (FAILED(DwmGetCompositionTimingInfo(NULL, &m_DwmTimingInfo)))
    {
        HDC hdc = GetDC(m_hwnd);
        m_DwmTimingInfo.rateCompose.uiDenominator = 1;
        m_DwmTimingInfo.rateCompose.uiNumerator = GetDeviceCaps(hdc, VREFRESH);
        ReleaseDC(m_hwnd, hdc);
    }

    ShowWindow(m_hwnd, SW_SHOWNORMAL);

    UpdateWindow(m_hwnd);
}

Requirements

Requirement Value
Library
D2d1.lib
DLL
D2d1.dll

See also

ID2D1Geometry