0
我已經嘗試過kCGBlendModeXOR,但它在透明後變黑。iPhone:如何在TouchesMoved事件上製作透明圖像?
這裏我的代碼,我做了,但它不是我想要的。
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self.view];
CGPoint lastPoint = [touch locationInView: [UIApplication sharedApplication].keyWindow];
UIGraphicsBeginImageContext(self.view.frame.size);
CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[imageView_skype.image drawInRect:rect];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, 36.0);
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0);
CGContextSetAlpha(context,0.10);
CGContextSetBlendMode(context, kCGBlendModeXOR);
CGContextBeginPath(context);
CGContextMoveToPoint(context, lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(context, currentPoint.x, currentPoint.y);
CGContextStrokePath(context);
imageView_skype.image = UIGraphicsGetImageFromCurrentImageContext();
什麼希望是事件touchesMoved我可以得到像素,並使其透明。所以我可以顯示背景視圖。 – sarak 2011-12-26 03:08:16