我有一个像这样的矩形 CPImage 设置
var img = [[CPImage alloc] initWithContentsOfFile:"Resources/img.jpg""];
我想在我的 CPView 子类中将其显示在一个圆圈中,其中图像的一部分(位于日食之外)保持透明。我试过这个:
- (void)drawRect:(CGRect)aRect
{
var path = [CPBezierPath bezierPathWithOvalInRect:aRect];
[[CPColor colorWithPatternImage:img] set];
[path fill];
}
但我只是得到一个黑色圆圈。