ID2D1Factory::CreateStrokeStyle methods

Creates an ID2D1StrokeStyle that describes start cap, dash pattern, and other features of a stroke.

Overload list

Method Description
CreateStrokeStyle(D2D1_STROKE_STYLE_PROPERTIES&, FLOAT*, UINT, ID2D1StrokeStyle**) Creates an ID2D1StrokeStyle that describes start cap, dash pattern, and other features of a stroke.
CreateStrokeStyle(D2D1_STROKE_STYLE_PROPERTIES*, FLOAT*, UINT, ID2D1StrokeStyle**) Creates an ID2D1StrokeStyle that describes start cap, dash pattern, and other features of a stroke.

Examples

The following example creates a stroke that uses a custom dash pattern.

// Dash array for dashStyle D2D1_DASH_STYLE_CUSTOM
float dashes[] = {1.0f, 2.0f, 2.0f, 3.0f, 2.0f, 2.0f};

// Stroke Style with Dash Style -- Custom
if (SUCCEEDED(hr))
{
    hr = m_pD2DFactory->CreateStrokeStyle(
        D2D1::StrokeStyleProperties(
            D2D1_CAP_STYLE_FLAT,
            D2D1_CAP_STYLE_FLAT,
            D2D1_CAP_STYLE_ROUND,
            D2D1_LINE_JOIN_MITER,
            10.0f,
            D2D1_DASH_STYLE_CUSTOM,
            0.0f),
        dashes,
        ARRAYSIZE(dashes),
        &m_pStrokeStyleCustomOffsetZero
        );
}

The next example uses the stroke style when drawing a line.

m_pRenderTarget->DrawLine(
    D2D1::Point2F(0, 310),
    D2D1::Point2F(200, 310),
    m_pCornflowerBlueBrush,
    10.0f,
    m_pStrokeStyleCustomOffsetZero
    );

Requirements

Requirement Value
Library
D2d1.lib
DLL
D2d1.dll

See also

ID2D1Factory