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

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,448 questions
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,562 questions
0 comments No comments
{count} votes

Accepted answer
  1. Xiaopo Yang - MSFT 11,581 Reputation points Microsoft Vendor

    Yes and Use ID2D1PathGeometry to build a shape and test hit. see GitHub TouchHitTesting sample.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful