0

我只是在开发一个绘图应用程序。我需要画一条透明的线,每当我画的时候,线上都会出现点。

我该如何解决这个问题?如何从线上删除点?

我的代码在下面

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

Ipad 屏幕截图的错误
(来源:4shared.com

4

1 回答 1

0

尝试使用UIBezierPath这个链接以供参考并根据您的需要进行修改。希望这对您有所帮助。

于 2012-06-15T09:23:03.717 回答