views:

87

answers:

3

Hi,

How do you make an NSImage Image have rounded corners? I'm doing Mac Dev not iPhone dev.

Thanks in advance.

+6  A: 

If you mean you want to draw a square image cropped to a rounded rectangle, take a look at NSBezierPath's clipping functions. Just clip to the frame you want and draw.

Chuck
A: 

Make the corners of a regular rectangular NSImage transparent. You can do that by ANDing the alpha channel of the bitmap or image with an appropriate round-rect mask or mask image.

hotpaw2
A: 

I have been using Björn Sallarp's code before for exactly this purpose. It is an old code, but works flawlessly and quickly. Take a look at his blog post.

rage