I am trying to create an application in which I can write. I have advanced this using CGContextRef. I wrote the following code.
previousPoint2 = previousPoint1; previousPoint1 = [touch previousLocationInView:m_secondaryDrawingImgeView]; currentPoint = [touch locationInView:m_secondaryDrawingImgeView]; // calculate mid point CGPoint mid1 = [self midPoint:previousPoint1 :previousPoint2]; CGPoint mid2 =[self midPoint:currentPoint :previousPoint1]; UIGraphicsBeginImageContext(m_secondaryDrawingImgeView.frame.size); [m_secondaryDrawingImgeView.image drawInRect: CGRectMake(0, 0, m_secondaryDrawingImgeView.frame.size.width, m_secondaryDrawingImgeView.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); // NSMutableArray *arr = [NSMutableArray arrayWithObjects:mid1, nil] // NSLog(@"%@",color); CGContextSetStrokeColorWithColor(context, color.CGColor); CGContextSetLineCap(context, kCGLineCapRound); CGContextSetLineWidth(context,m_width); CGContextStrokePath(context); m_secondaryDrawingImgeView.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
When I set the opacity of my color, it shows the dots in the line that I want to delete.
Am I going right? Is there any way to remove these points?
Attach images for clarity. What happens after writing this code is image-1, and I want image-2


source share