2012-04-30 7 views
1

UIBezierPathの外側のエッジを作る:私は現在とても似UIBezierPath以内にUIImageを描いていた半透明の

UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0); 
UIBezierPath *polygonPath = [UIBezierPath bezierPath]; 

CGPoint curPoint = [self originalPoint:[[drawArray objectAtIndex:0]CGPointValue]]; 

// set the starting point for the lines 
[polygonPath moveToPoint:curPoint]; 

// go through each point in drawArray and add it to polygonPath 
for(NSInteger i = 1; i < [drawArray count]; i++) { 
    curPoint = [self originalPoint:[[drawArray objectAtIndex:i]CGPointValue]]; 
    // scale point 
    curPoint = CGPointMake(curPoint.x, curPoint.y); 

    [polygonPath addLineToPoint:curPoint]; 
} 

[polygonPath closePath]; 

[polygonPath addClip]; 

[image drawAtPoint:CGPointZero]; 

しかし、私は少し、「滑らかなエッジ」を持っているしたいのですが、素晴らしい作品私は別のイメージの上にそれを描画しているように、イメージの透明...今すぐエッジはかなりラフです。あなたの助けのための

ありがとう!

答えて

0

あなたがイメージに描いているように。そこで、次のコードを使用することをお勧めします。

ここでYourImageは、描画する線であるUIImageです。

[[UIColor colorWithPatternImage:YourImage] set]; 

For More Visit this reference

希望、これはあなたを助ける...

関連する問題