2012-04-14 195 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