Skia layer order

Is there any way to change drawing order of Skia layers other than the order they go into group nodes?
Or possibility to do this in future?

The use case is doing both background and ‘always on top’ pop up drawing from inside a UI widget. The solution at the moment is to make a separate ‘on top’ layer pipeline but before I do that checking to see if there’s an easier way from within Skia.

would love to see that too!

You could introduce a small datatype “LayerWithPriority” with just two fields “Layer” and “Priority”.
High priority would render first.

A UI Widget could now output a Spread of LayerWithPriority. This way you could output 2 layers with priority over one output pin. One for foreground one for background.

Downstream before rendering you could then order by descending priority, select the layers and put them into a group (spectral).

For sure can do.
I just wondered if there was a function inside of skia for this purpose that perhaps I’d missed.

No, no. there is nothing like that.

My theory is this:
you typically want the simple layer system as it doesn’t come with the burden of juggling priorities in all your patches and getting them right.
but there is this other case where you want to work with priorities.
i think they are hard or impossible to combine. So basically they will always be different types of layers.

So if this Spread of LayerWithPriority idea works well for you, we can maybe at some time copy it into VL.Skia or even sugar it a bit more so that you don’t need to work with cons to group your widgets, but again can work group nodes or there might be a node that is just called ToLayer that internally does the ordering and grouping of the prioritized layers…

Tell us how it works out for you

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.