C++ Drawing arcs in Direct2D Device
سؤال
I need to draw an arc in a D2D device, is there a function that does this?(something like DrawLine or DrawEllipse) Otherwise, i've seen that there is the ArcSegment function that returns a D2D1_ARC_SEGMENT structure, how can i draw that?
المحلول
The D2D1_ARC_SEGMENT
can be used when populating a path geometry (ID2D1PathGeometry
). Once you've added the arc you want to the path, you can draw it using ID2D1RenderTarget::Draw/FillGeometry()
.
نصائح أخرى
Im not too familiar with Direct2D so I am unaware of any specific function that would allow you to do this, however it does not stop you from implementing your own function to achieve what you want.
I recommend looking into splines and how they are calculated wiki
seems like a good place to start. You could then generate your Arc with with the formula and several DrawLine calls.
Edit: or even this may serve you better.