NSColor alpha value darkens color
문제
I am trying to fill an NSRect in a subview with a translucent color. I am using:
[[NSColor colorWithCalibratedWhite:1 alpha:0.5]set];
But the alpha value doesn't make it transparent but just darker. Using an alpha value of 0 simply gives black. I have used this code many times before and i do not know why it is not working.
Thank you in advance, Ben.
해결책
The color appears darker because the context itself is not transparent, you're seeing the blacks bleed through behind the transparency. You need to use this operation:
NSRectFillUsingOperation(theRect, NSCompositeSourceOver);
제휴하지 않습니다 StackOverflow