Qt World Summit: Register Today!

Drawing QQuickRectangle like Blend.mode="addition" instead of normal alpha blending

  • I want 3+ overlapping QML Rectangle items to add their pixel color values instead of doing alpha blending (also doing alpha would be nice, if that can be preserved).

    One idea I had was to send each one to a ShaderEffectSource, then maintain a list of the Rectangles and Blend the first one onto the background, then Blend the second one onto that, and so on, only displaying the final result. I wasn't able to get scaling and visibility and transparency to work for this.

    Another idea was to make an extra white Rectangle for each original Rectangle, and put all the white ones at the back of the scene, and adjust their alpha in time with their linked original. This greatly increased the gamut of possibilities, but still didn't have the desired effect where bright colors overlap.

    My next idea is going to be to dive all the way down into qtdeclarative/src/*/scenegraph and hack away in hopes of finding a way to do this on one or more platforms, and then exposing that upwards as an abstracted option somewhere.

    My hope is that someone here might be able to suggest a less drastic approach.

Log in to reply