1

現在、次のように 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];

それはうまく機能しますが、別の画像の上に描画しているので、画像に少し透明な「滑らかなエッジ」が必要です...現在、エッジはかなり粗いです。

ご協力いただきありがとうございます!

4

1 に答える 1

0

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

YourImage は、線を描画している UIImage です。

[[UIColor colorWithPatternImage:YourImage] set];

詳細については、このリファレンスをご覧ください

うまくいけば、これはあなたを助けるでしょう...

于 2012-04-30T02:15:47.623 に答える