NSBezierPath with transparent fill

Posted by nosedive25 on Stack Overflow See other posts from Stack Overflow or by nosedive25
Published on 2013-06-28T22:19:30Z Indexed on 2013/06/28 22:21 UTC
Read the original article Hit count: 211

Filed under:
|
|
|

I've got a NSBezierPath that needs to have a semi-transparent fill. When I fill it with a solid color, I get the expected result. However, when filled with a semi-transparent color I get a path with a rounded stroke but an odd, rectangular fill. It looks like:

Rectangular fill

Instead of filling the entire area, I get a filled rectangle inside the stoke with a small, unfilled boarder. I set up my path as follows:

NSBezierPath *menuItem = [NSBezierPath bezierPathWithRoundedRect:menuItemRect xRadius:3 yRadius:3]

[menuItem setLineWidth:4.0];
[menuItem setLineJoinStyle:NSRoundLineJoinStyle];

[[NSColor whiteColor] set];
[menuItem stroke];

[[NSColor colorWithCalibratedRed:0.000 green:0.000 blue:0.000 alpha:0.500] set];
[menuItem fill];

If anyones got any ideas, that would be great.

Thanks

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nsview