ID2D1StrokeStyle interface (d2d1.h)

Describes the caps, miter limit, line join, and dash information for a stroke.

Inheritance

The ID2D1StrokeStyle interface inherits from ID2D1Resource. ID2D1StrokeStyle also has these types of members:

Methods

The ID2D1StrokeStyle interface has these methods.

 
ID2D1StrokeStyle::GetDashCap

Gets a value that specifies how the ends of each dash are drawn.
ID2D1StrokeStyle::GetDashes

Copies the dash pattern to the specified array.
ID2D1StrokeStyle::GetDashesCount

Retrieves the number of entries in the dashes array.
ID2D1StrokeStyle::GetDashOffset

Retrieves a value that specifies how far in the dash sequence the stroke will start.
ID2D1StrokeStyle::GetDashStyle

Gets a value that describes the stroke's dash pattern.
ID2D1StrokeStyle::GetEndCap

Retrieves the type of shape used at the end of a stroke.
ID2D1StrokeStyle::GetLineJoin

Retrieves the type of joint used at the vertices of a shape's outline.
ID2D1StrokeStyle::GetMiterLimit

Retrieves the limit on the ratio of the miter length to half the stroke's thickness.
ID2D1StrokeStyle::GetStartCap

Retrieves the type of shape used at the beginning of a stroke.

Remarks

Creating ID2D1StrokeStyle Objects

To create a stroke style, use the ID2D1Factory::CreateStrokeStyle method.

A stroke style is a device-independent resource; you can create it once then retain it for the life of your application. For more information about resources, see the Resources Overview.

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
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1.h

See also

ID2D1Factory::CreateStrokeStyle

ID2D1Resource