2011-12-26 46 views
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(); 

回答