iOSで角丸長方形を描いています。
この四角形には、ベジエ パスでクリッピングしているイメージの背景があり、その中に 2 ピクセルの幅のストロークを描画しています。
私の問題は、丸みを帯びた四角形のパスをたどるように見えるのではなく、ストロークの内側に鋭いエッジがあることです。
これは、私が扱っている問題を示すために白色を増やしたスクリーンショットです。
これが私のコードです:
CGContextRef context = UIGraphicsGetCurrentContext();
CGPathRef strokeRect = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:2].CGPath;
CGContextAddPath(context, strokeRect);
CGContextClip(context);
// draw background
[[UIImage imageNamed:@"background.png"] drawInRect:rect];
// draw stroke
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 0.1);
CGContextStrokeRectWithWidth(context, rect, 2);