Closed moazin closed 2 years ago
@dirkschulze This looks good, however, the problem still persists in Cairo. I can do the same nested mOpacityStack
thing that I did in GDI+. You mentioned that there's an equivalent call to saveLayerAlpha
for Cairo, but I couldn't find it. Can you point to it? If one doesn't exist, I can do the same for Cairo as I did it for GDI+.
@moazin You can use
cairo_push_group(cr);
// put cr on a stack so you can call cairo_push_group multiple times
// to create more layers. Needed for nested opacity.
to create a new layer and then draw it back with
cairo_pop_group_to_source(cr);
cairo_paint_with_alpha(cr, crFromTopOfStack);
You can take a look at the WebKit code I wrote years ago: https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp#L1198
This fixes #154 partially. I've done the Skia fix.
@dirkschulze For cairo, you pointed out that they have APIs for transparency layers. Could you point them to me, I couldn't find something simple.