如果未存储原始 CGPoints,如何将存储的 CGPath 重绘为 Bezier 路径?
这是代码,但它不起作用(在标准模式下重绘路径而不是在贝塞尔模式下):
CGMutablePathRef UpathFREEHAND = CGPathCreateMutable();
CGPoint firstPointFH = [[pointArray objectAtIndex:0] CGPointValue];
CGPathMoveToPoint(UpathFREEHAND, NULL, firstPointFH.x, firstPointFH.y);
for (int i = 0; i < [pointArray count]; i++)
{
CGPathAddLineToPoint(UpathFREEHAND, NULL, [[pointArray objectAtIndex:i] CGPointValue].x,
[[pointArray objectAtIndex:i] CGPointValue].y);
}
CGMutablePathRef _TempPathForUndo = UpathFREEHAND;
//Add PATH object to array
[UPath addObject:CFBridgingRelease(_TempPathForUndo)];
//Load PATH object from array
_TTempPathForUndo = (__bridge CGMutablePathRef)([UPath objectAtIndex:i]);
// Now create the UIBezierPath object.
UIBezierPath *bp;
bp = [UIBezierPath bezierPath];
bp.CGPath = _TTempPathForUndo;
CGContextAddPath(context, bp.CGPath);
//Color, Brush Size parameters, Line cap parameters..
CGContextStrokePath(context);