我用来在我的应用程序中绘制的这段代码。所以我有问题,如果我使用 alpha 属性 = 1 进行绘制。这非常好,但是如果我更改 alpha 属性 = 0.2,那么我的油漆就不好了。如何使用 alpha 属性 = 0.2 做得更好。
http://www.flickr.com/photos/9601621@N05/page1/
用 alpha = 1 绘制:很好 用 alpha = 0.2 绘制:不好
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
if ([self.view superview] && (headerView.frame.origin.y == -30)) {
mouseSwiped = YES;
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self.view];
currentPoint.y -= 20;
UIGraphicsBeginImageContext(self.view.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, currentBrushProperty.brushSize);
CGContextSetRGBStrokeColor(context, [self red], [self green], [self blue], currentBrushProperty.brushTransparency);
CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0);
CGContextBeginPath(context);
CGContextMoveToPoint(context, lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(context, currentPoint.x, currentPoint.y);
CGContextStrokePath(context);
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
lastPoint = currentPoint;
}}