Is it possible to get the data points of a vector path?
Estimated Reading Time: 1 MinutesIf you are trying to recognize the shape of a vector path, attempting to locate all rectangles for example, you would need to parse the segments from the Path element. It is important to keep in mind that specific shapes can be built in many ways, using different operators. For example, you could build a filled rectangle with a rect operator, or using four lineto operators followed by a fill, or three lineto operators, a closepath and a fill.
Adobe C/C++
The data that comprises a PDEPath object can be obtained from the PDEPathGetDataFloat() API. This is raw data containing the operands and operators (moveto, lineto, etc.) that draw the path.
The data essentially consists of an array of structs containing an operator identifier then 3 (x,y) point coordinates. Below is some example code for extracting this data from a PDEPath.
Modern C++ SDK
The equivalent method is Path.get_Segments()
.NET and Java
The equivalent functions are Path.Segments and Path.getSegments() respectively.