如何在iPhone上用手指滑動/觸摸運動繪製平滑線?我有以下代碼,但它不光滑。例如,當我嘗試做一個循環時,它會讓角落/轉彎。我想我必須使用OpenGL。有任何想法嗎?示例代碼?教程?在iPhone上用手指觸摸繪製平滑線
謝謝!
UIGraphicsBeginImageContext(self.view.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
CGContextSetAllowsAntialiasing(UIGraphicsGetCurrentContext(), YES);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
我結束了使用Open GL和顆粒。檢查這個的好例子是Apple的GLPaint示例代碼。 – Sharief 2010-04-22 21:54:04