简体   繁体   English

CGContext绘制两个具有不透明度的UIColor

[英]CGContext draw with two UIColor with opacity

I am drawing a line using CGContext and color has transparency of 0.7 , Now i want to draw another line with another color with same transparency on that previous line . 我正在使用CGContext绘制一条线,颜色的透明度为0.7,现在我想用另一种颜色绘制另一条线,在前一行上使用相同的透明度。 But i get the second line color as a solid color without any transparency in the part where this both two lines intersect. 但我得到第二线颜色为纯色,两条线相交的部分没有任何透明度。 For first line i am using blend effect clear to draw a transparent line and for the second line i am using blend effect color. 对于第一行我使用混合效果清除绘制透明线,而对于第二行我使用混合效果颜色。 Please tell me how to draw these two lines separately so that the second line drawn can have its own separate color . 请告诉我如何分别绘制这两条线,以便绘制的第二条线可以有自己独立的颜色。

默认的混合模式( kCGBlendModeNormal )应该在两种情况下都提供您想要的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM