Yes and Use ID2D1PathGeometry to build a shape and test hit. see GitHub TouchHitTesting sample.
Drawing custom shape using lines in Direct2D
![](https://techprofile.blob.core.windows.net/images/CFIB-zqfp0esdKGTs5ax_A.png?8DA8BE)
thebluetropics
1,046
Reputation points
In Direct2D, is it possible to create a custom shape using lines? Here is the pseudo code:
d2dDeviceContext->BeginShape(10, 10);
d2dDeviceContext->LineTo(32, 42);
d2dDeviceContext->LineTo(10, 74);
d2dDeviceContext->LineTo(10, 10);
d2dDeviceContext->FillShape(blackBrush);
Note that I don't want to draw the lines, just filling the shape with a color.
Also, is it possible to make it hit-detectable by using ID2D1Geometry::FillContainsPoint()
?
Accepted answer
-
Xiaopo Yang - MSFT 12,231 Reputation points Microsoft Vendor
2022-10-06T03:05:33.673+00:00