質問

Let's say I have a canvas with stuff on it, and I want to carve an ellipse in it's center, whose all of the pixels have an alpha of 0, to let everything behind the canvas to pass through, and given that previously the area now filled by the ellipse was something else, and said that, for performance reasons, I don't want to use putImageData, how would I do so? And if there isn't a way, how would I carve an ellipse using putImageData?

Just to make it clear: I don't want to draw the html elements on the canvas, I want them to simply be in html behind it

役に立ちましたか?

解決

you can use context.globalCompositeOperation = 'destination-out' after you draw the frame to fill the clipped shape(s).

example: http://jsfiddle.net/rlemon/6nEpc/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top