0

I want to make a program works like photoshop. So I tried to modify the globalCompositeOperation to simulate the layer blending property

However, Kinetic.Context does not pass the globalCompositeOperation property to real contetx2d.

After trace the code http://pastebin.com/4neU7VF8 (link to modified kineticJs also included)

I modify the Kinetic.Context to allow such action.

And modify Kinetic.Node to make it remember what globalCompositeOperation it was settled.

And modify kinetic.Container.prototype._drawChildren to make it switch globalCompositeOperation of context automatically base on what globalCompositeOperation its child nodes desire.

After done that. it actually works in plain container such as a Kinetic.Layer contains several Kinetic.Shape

however it seems doesn't work in nested containers, such as a stage contains two layer and the top layer has the globalCompositeOperation attribute just like the layer contains red line in this http://jsbin.com/tumef/16/

Does anyone has idea, what did I miss?

4

0 回答 0