所以我试图使用colorwithpatternimage将重复图像放到NSView上。然而,当我这样做时,我也没有得到图像的alpha值,正如你在这里看到的那样:
这是迄今为止的代码:
- (void)drawRect:(NSRect)rect
{
[[NSColor whiteColor] set]; //setting up and drawing the background
NSRectFill([self bounds]);
[BkImage drawInRect: destRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
NSColor *PetalPattern = [NSColor colorWithPatternImage:PetalImage];
[PetalPattern setFill];
NSRectFill (floatRect);
}