当opcity改变时,绘图不正确

时间:2011-12-09 12:42:01

标签: ipad ios-4.2 uicolor

  UITouch *touch = [touches anyObject];
            previousPoint2 = previousPoint1;
            previousPoint1 = [touch previousLocationInView:m_img];
            currentPoint = [touch locationInView:m_img];
                     // calculate mid point
            CGPoint mid1 = [self midPoint:previousPoint1 :previousPoint2];
            CGPoint mid2 =[self midPoint:currentPoint :previousPoint1];
            UIGraphicsBeginImageContext(m_img.frame.size);
            [m_img.image drawInRect:CGRectMake(0, 0, m_img.frame.size.width, m_img.frame.size.height)];
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextMoveToPoint(context, mid1.x, mid1.y);
            // Use QuadCurve is the key
            CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y); 
            NSLog(@"%@",color);
            CGBitmapContextGetColorSpace(context);   



            //
            CGContextSetStrokeColorWithColor(context, color.CGColor);
            CGContextSetLineCap(context, kCGLineCapRound);
            CGContextSetLineWidth(context,m_width);
            CGContextStrokePath(context);
            m_img.image = UIGraphicsGetImageFromCurrentImageContext();
            UIGraphicsEndImageContext();

我正在使用此代码进行绘制,但是某些圆圈出现在绘图路径中。 我尝试了不同的颜色样式 任何人都可以帮助...... the output is like that . i dont want that circle

1 个答案:

答案 0 :(得分:2)

CGContextSetBlendMode(context, kCGBlendModeCopy);

只有这个缺失