Yes and Use ID2D1PathGeometry to build a shape and test hit. see GitHub TouchHitTesting sample.
Drawing custom shape using lines in Direct2D

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()
?
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,774 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,968 questions
Accepted answer
-
Xiaopo Yang - MSFT 12,731 Reputation points Microsoft External Staff
2022-10-06T03:05:33.673+00:00