背景画像に描画したいのですが、その描画を消去してから、背景画像ではなく描画のみを消去する場合、どうすればそのタスクを実行できますか?このコードによって、背景画像も消去されます。
` UITouch *touch = [touches anyObject];
previousPoint2 = previousPoint1;
previousPoint1 = [touch previousLocationInView:self.view];
currentPoint = [touch locationInView:self.view];
CGPoint mid1 = midPoint(previousPoint1, previousPoint2);
CGPoint mid2 = midPoint(currentPoint, previousPoint1);
UIGraphicsBeginImageContext(imageDoodle.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[imageDoodle.image drawInRect:CGRectMake(0, 0, imageDoodle.frame.size.width, imageDoodle.frame.size.height)];
CGContextMoveToPoint(context, mid1.x, mid1.y);
CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y);
CGContextSetLineCap(context, kCGLineCapRound);
if(IsErase)
{
CGContextSetBlendMode(context,kCGBlendModeClear);
}
else
{
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), redvalue, greenvalue, bluevalue, 1.0);
}
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 8.0);
CGContextStrokePath(UIGraphicsGetCurrentContext());
imageDoodle.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
`