Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You might try this:</p> <pre><code>UIBezierPath *yourPath; // Assume this has some points in it CGPath yourCGPath = yourPath.CGPath; NSMutableArray *bezierPoints = [NSMutableArray array]; CGPathApply(yourCGPath, bezierPoints, MyCGPathApplierFunc); </code></pre> <p>The path applier function will be handed each of the path's path elements in turn.<br> Check out <a href="http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGPath/Reference/reference.html" rel="noreferrer">CGPathApplierFunction</a> and <a href="http://www.mlsite.net/blog/?p=1312" rel="noreferrer">CGPathApply</a>.</p> <p>The path applier function might look something like this</p> <pre><code>void MyCGPathApplierFunc (void *info, const CGPathElement *element) { NSMutableArray *bezierPoints = (NSMutableArray *)info; CGPoint *points = element-&gt;points; CGPathElementType type = element-&gt;type; switch(type) { case kCGPathElementMoveToPoint: // contains 1 point [bezierPoints addObject:[NSValue valueWithCGPoint:points[0]]]; break; case kCGPathElementAddLineToPoint: // contains 1 point [bezierPoints addObject:[NSValue valueWithCGPoint:points[0]]]; break; case kCGPathElementAddQuadCurveToPoint: // contains 2 points [bezierPoints addObject:[NSValue valueWithCGPoint:points[0]]]; [bezierPoints addObject:[NSValue valueWithCGPoint:points[1]]]; break; case kCGPathElementAddCurveToPoint: // contains 3 points [bezierPoints addObject:[NSValue valueWithCGPoint:points[0]]]; [bezierPoints addObject:[NSValue valueWithCGPoint:points[1]]]; [bezierPoints addObject:[NSValue valueWithCGPoint:points[2]]]; break; case kCGPathElementCloseSubpath: // contains no point break; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload