我只是在开发一个绘图应用程序。我需要画一条透明的线,每当我画的时候,线上都会出现点。
我该如何解决这个问题?如何从线上删除点?
我的代码在下面
- (UIImage *)drawSmoothLine // stright line correct
{
CGPoint mid1 = midPoint(previousPoint1, previousPoint2);
CGPoint mid2 = midPoint(currentPoint, previousPoint1);
CGSize screenSize = self.frame.size;
UIGraphicsBeginImageContext(screenSize);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.layer drawInContext:context];
CGContextMoveToPoint(context, mid1.x, mid1.y);
CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetStrokeColorWithColor(context, drawColor.CGColor);
CGContextSetBlendMode(context, kCGBlendModeColorBurn);
CGContextSetLineWidth(context, lineWidth);
CGContextStrokePath(context);
UIImage *ret = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return ret;
}
(来源:4shared.com)