私にCGPathRef
は5つの要素があり、開始点を削除したいのですが、開始点が削除したい開始点のパスの終了と同じである4つの要素を持つパスがあります。
これは、例外を生成する私の関数です。
static void constructPath(void *info, const CGPathElement *element)
{
NSBezierPath *bezierPath = (NSBezierPath *)info;
switch (element->type) {
case kCGPathElementMoveToPoint:
// some kind of skipping using points[0] kCGPathElementMoveToPoint
[bezierPath lineToPoint:element->points[1]]; // line exception in gdb
[bezierPath lineToPoint:element->points[2]];
[bezierPath lineToPoint:element->points[3]];
[bezierPath lineToPoint:element->points[4]];
break;
case kCGPathElementAddLineToPoint:
if ([bezierPath isEmpty]) {
[bezierPath moveToPoint:element->points[0]]; // the new start, how to go to next from here ?
} else {
[bezierPath moveToPoint:element->points[1]];
[bezierPath moveToPoint:element->points[2]];
[bezierPath moveToPoint:element->points[3]];
[bezierPath moveToPoint:element->points[4]];
}
break;
default:
break;
}
}