The following picture show a path geometry in Direct2D, it contains 5 segments, each segment is a straight line, my request is that, given such a hill, i want to get all the 5 lines.

but it seems there is no related API can get the segments of a path geometry in Direct2D, I see the ID2D1PathGeometry interface provide a method GetSegmentCount, if we can not get the segments, why Microsoft provide this method?
You can do this with
ID2D1PathGeometry::Stream(). You will have to write a class that implementsID2D1GeometrySink. You may find it useful to implement this in a generalized sense such that instead of looking for the exact data that you need now, it can pump out an object tree. If you need an example for what type of object model to use, look no further than WPF’sSystem.Windows.Media.Geometry( http://msdn.microsoft.com/en-us/library/system.windows.media.geometry.aspx ).You can also easily convert from those classes back to
ID2D1PathGeometry, and use whichever is most comfortable or appropriate for any situation. I’ve written both conversions and found it to be pretty straightforward once I realized they were using the same “language.” I especially found that it helped to organize my understanding as to the difference between “figures” and “segments.”