2012-01-21 4 views
0

私は作っている小さな描画アプリケーションで遊んでいて、Photoshopのように "ブラシ"をどのように変更するのかと思っていました。私はカスタム画像を単なる丸ではなくブラシとして使用したいと思います。これをどうやって行うのですか?あなたはブラシストロークを構成する線分に沿ったいくつかの点で、適切なブレンドで、ブラシ画像を描画する必要がUIGraphicsで描画する

UIGraphicsBeginImageContext(self.view.frame.size); 

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

    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); 

    CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeCopy); 

    CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.0, 0.0, 1.0); 


    CGContextSetLineWidth(UIGraphicsGetCurrentContext(), currentSize); 

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

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

    CGContextStrokePath(UIGraphicsGetCurrentContext()); 

    CGContextFlush(UIGraphicsGetCurrentContext()); 

    drawImage.image = UIGraphicsGetImageFromCurrentImageContext(); 

    UIGraphicsEndImageContext(); 

答えて

0

:ここ

は、私は現在の描画方法です。