简体   繁体   中英

Multiple blend mode in a CGContext

I am drawing on a CGContext.

In order to simplify the situation, let's say I have two collections of CGPath. For the collection on top, when two path in the layer overlap, I just want the top path to cover another, so I use blend mode of destinationOver.

But when blending the top collection with the bottom collection, I want to mix the color of them, so I want to use blend mode of normal. However, it seems that I can only blend the new color to the background color, but not blend the top collection with specific method first, and them blend it with the background collection with another method.

Is it possible to draw a picture with its own blending mode first, and then blend it with the picture beneath it? Is it possible to create two "layers" when drawing by cgcontext? Actually, I have found something called CGLayer, but it seems that it is not recommended and I can not find any information about how to draw with the CGLayer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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