开发者

Core Graphics: How to draw overlapped semi transparent rectangle without changing color of the common area

开发者 https://www.devze.com 2023-04-11 23:05 出处:网络
When two semi-transparent overlaps, the part in the middle will combines and blends into a darker color. Is there any way to draw rect as usual, but keep the overlapped part sam开发者_如何学JAVAe colo

When two semi-transparent overlaps, the part in the middle will combines and blends into a darker color. Is there any way to draw rect as usual, but keep the overlapped part sam开发者_如何学JAVAe color and transparency as remaining part of the rect?


You could calculate the intersection with

rect = CGRectIntersection(bottomRect, topRect)

Then draw the bottomRect, then fill the calculated rect with the default solid background color and draw the topRect on top of it.

0

精彩评论

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

关注公众号