ID2D1StrokeStyle interface
Describes the caps, miter limit, line join, and dash information for a stroke.
When to implement
Custom implementations are not supported.
Members
The ID2D1StrokeStyle interface inherits from ID2D1Resource. ID2D1StrokeStyle also has these types of members:
Methods
The ID2D1StrokeStyle interface has these methods.
| Method | Description |
|---|---|
| GetDashCap |
Gets a value that specifies how the ends of each dash are drawn. |
| GetDashes |
Copies the dash pattern to the specified array. |
| GetDashesCount |
Retrieves the number of entries in the dashes array. |
| GetDashOffset |
Retrieves a value that specifies how far in the dash sequence the stroke will start. |
| GetDashStyle |
Gets a value that describes the stroke's dash pattern. |
| GetEndCap |
Retrieves the type of shape used at the end of a stroke. |
| GetLineJoin |
Retrieves the type of joint used at the vertices of a shape's outline. |
| GetMiterLimit |
Retrieves the limit on the ratio of the miter length to half the stroke's thickness. |
| 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-indenpendent 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
|
Minimum supported client |
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps] |
|
Minimum supported phone |
Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also