我正在尝试为iPad制作一个Brush / Paint应用程序让我更熟悉Objective-C并且能够流利地使用它。现在,我已经有了一个基本的着色应用程序,我想将其纹理改进为类似于Zen Brush的东西。我想让它在用户开始画画时有更像画笔的感觉。
我将如何做到这一点?
以下是我的应用程序绘图部分的代码:
currentTouch = [touch locationInView:self.view];
currentTouch.y -= 20;
UIGraphicsBeginImageContext(self.view.frame.size);
[touchDraw.image drawInRect:CGRectMake(0, 0, touchDraw.frame.size.width, touchDraw.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 25.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), redAmt, greenAmt, blueAmt, alpha);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), endingPoint.x, endingPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentTouch.x, currentTouch.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
touchDraw.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
endingPoint = currentTouch;
touchMoved++;
if (touchMoved == 10) {
touchMoved = 0;
}
这是我学校项目的准备工作,将于30日结束。
谢谢!