任何人都可以在这段代码中看到一些东西,它允许它在iPhone上使用黄油软,但iPad上的视网膜和非视频都很慢而且不稳定/粗糙?有关如何加速iPad的任何想法?我只是希望手指画画基本上,控制画笔大小,不透明度和边缘(这就是为什么我有渐变,软边缘)
谢谢
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint currentPointTemp = [touch locationInView:parentView.view];
CGPoint currentPoint = CGPointMake((currentPointTemp.x /imageScale)+ (posOffset.x/imageScale), (currentPointTemp.y /imageScale) + (posOffset.y/imageScale));
currentPoint.y -= 10;
UIGraphicsBeginImageContextWithOptions(CGSizeMake(drawImage.frame.size.width, drawImage.frame.size.height), NO, 0);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetAlpha(UIGraphicsGetCurrentContext(), opacity);
CGContextBeginPath (UIGraphicsGetCurrentContext());
CGContextAddArc(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y, glamzyDelegate.brushSize, 0, 6.28318531, 0);
CGContextClosePath (UIGraphicsGetCurrentContext());
CGContextClip(UIGraphicsGetCurrentContext());
CGPoint myStartPoint, myEndPoint;
CGFloat myStartRadius, myEndRadius;
myStartPoint.x = lastPoint.x;
myStartPoint.y = lastPoint.y;
myEndPoint.x = lastPoint.x;
myEndPoint.y = lastPoint.y;
myStartRadius = 0;
myEndRadius = glamzyDelegate.brushSize;
CGContextDrawRadialGradient(UIGraphicsGetCurrentContext(), gradient, myStartPoint, myStartRadius, myEndPoint, myEndRadius, kCGGradientDrawsAfterEndLocation);
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
lastPoint = currentPoint;
}
答案 0 :(得分:0)
永远不要在触摸事件中调用任何绘图例程。