2012-04-14 146 views
-1

我正在尝试开发着色应用程序。我想从一张空白的画布开始,并且使用触摸的用户颜色我想只显示彩色图像的那些触摸区域。我如何实现这一目标?任何帮助对我都有很大的帮助。iOS着色透明图像

+0

找触摸事件 – 2012-04-14 07:34:33

回答

0

可能是这将有助于你开始踢

UITouch *touch = [touches anyObject]; 

    CGPoint currentPoint = [touch locationInView:drawImage]; 


    UIGraphicsBeginImageContext(drawImage.frame.size); 

    [drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)]; 

    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); 

    CGContextSetLineWidth(UIGraphicsGetCurrentContext(), size); 


     CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), r, g, b, a); 


    CGContextBeginPath(UIGraphicsGetCurrentContext()); 

    CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y); 

    CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y); 

    CGContextStrokePath(UIGraphicsGetCurrentContext()); 

    drawImage.image = UIGraphicsGetImageFromCurrentImageContext(); 

    UIGraphicsEndImageContext(); 

虽然我还没有尝试,但发现太问题是你问什么

+0

由于工作的罚款。但我如何整合混合模式?正如我所问,我需要揭示颜色。 – user1191140 2012-04-14 08:06:00