을 제거 선 그리기 :IOS : 내 코드에서 다른 라인
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
mouseSwiped = YES;
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:drawImage];
UIGraphicsBeginImageContext(drawImage.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 10.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), r, g, b, a);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
lastPoint = currentPoint;
mouseMoved++;
if (mouseMoved == 10) {
mouseMoved = 0;
}
}
내가의 drawImage에 선을 그릴 수 있어요,하지만 나는 다른 줄을 제거 선을 그리려면? 그려진 다른 선을 취소하는 지우개로. 그것은 가능한가?
중복 가능성을 그릴 수 있습니다에 의해 이미지에서 라인을 삭제하는 방법 그림?] (http://stackoverflow.com/questions/8317152/cocoa-how-to-to-er-line-from-image-by-painting) – jrturton
예이 링크는 당신을 도울 수 http : // stackoverflow. co.kr/questions/3863931/수동 삭제 옵션 - ipad-painting-application-by-quartz/12797513 # comment19041354_12797513 –