开发者

Make an Image have rounded corners with Objective-C / pure C

开发者 https://www.devze.com 2023-01-14 08:04 出处:网络
How do you make an NSImage Image have rounded corners? I\'m doing Mac Dev not iPhone de开发者_运维百科v.

How do you make an NSImage Image have rounded corners? I'm doing Mac Dev not iPhone de开发者_运维百科v.

Thanks in advance.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消