我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;
}
}