nidium/Nidium

Canvas opacity compositing

paraboul opened this issue · 0 comments

Currently, if we set a canvas opacity, the value is propagated to all the children.
The opacity should apply the composition, not to each child node.

Test case :

            var mchild3 = Elements.Create("flexcanvas", {
                height: 150,
                width: 200,
            });

            mchild3.color = "Moccasin";
            mchild3.position = "relative";
            mchild3.left = 60;
            mchild3.top = 80;
            mchild3.opacity = 0.7;
            
            document.canvas.add(mchild3);

            var mchild4 = Elements.Create("flexcanvas", {
                height: 40,
                width: 40,
            });

            mchild4.color = "Crimson";
            mchild4.position = "relative";
            mchild4.left = -10;
            mchild4.top = -10;

            mchild3.add(mchild4);

In this example, we should not be able to see through the second canvas on the first one. (The composition of mchild3 and mchild4 should be "atomic")