Skip to content

Latest commit

 

History

History
123 lines (94 loc) · 3.45 KB

nn-d2d1-id2d1strokestyle.md

File metadata and controls

123 lines (94 loc) · 3.45 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NN:d2d1.ID2D1StrokeStyle
ID2D1StrokeStyle (d2d1.h)
Describes the caps, miter limit, line join, and dash information for a stroke. (ID2D1StrokeStyle)
ID2D1StrokeStyle
ID2D1StrokeStyle interface [Direct2D]
ID2D1StrokeStyle interface [Direct2D]
described
d2d1/ID2D1StrokeStyle
direct2d.ID2D1StrokeStyle
direct2d\ID2D1StrokeStyle.htm
Direct2D
2cdf66dc-f34f-4132-8c06-7464648d3cef
12/05/2018
ID2D1StrokeStyle, ID2D1StrokeStyle interface [Direct2D], ID2D1StrokeStyle interface [Direct2D],described, d2d1/ID2D1StrokeStyle, direct2d.ID2D1StrokeStyle
d2d1.h
Windows
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps \| UWP apps]
Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps \| UWP apps]
D2d1.lib
D2d1.dll
Windows
19H1
ID2D1StrokeStyle
d2d1/ID2D1StrokeStyle
c++
APIRef
kbSyntax
COM
D2d1.dll
ID2D1StrokeStyle

ID2D1StrokeStyle interface

-description

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:

-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
    );

-see-also

ID2D1Factory::CreateStrokeStyle

ID2D1Resource