How to get the CGPoint(s) of a CGPath

前端 未结 4 1172
天命终不由人
天命终不由人 2020-11-27 04:22

How can I get an array with all the CGPoint(s) contained in a given CGPath (CGMutablePathRef)?

4条回答
  •  隐瞒了意图╮
    2020-11-27 05:02

    A CGPath is an opaque data type and does not necessarily store all the points used. In addition to this, a path may not actually draw all the points used as input (for example, consider Bézier control points).

    The only two documented ways of getting information out of a path is to use CGPathGetBoundingBox to get the bounding box, or the more complicated method of using CGPathApply to call a callback function that will give you a sequence if CGPathElement types.

提交回复
热议问题