Clearing the pixels of the font path in HTML <canvas>

I would like to know how can I create a colored canvas, but with transparent parts with a font. I want the font to create a hole in this canvas. Is this possible and how? My goal is to give the impression that the image is captured in font ...

Thank:)

+3


source to share


1 answer


<canvas>

offers something called clipping compound operations and such effects. I believe the operation you want is called assignment:

https://developer.mozilla.org/samples/canvas-tutorial/6_1_canvas_composite.html

And here are some more technical details in the spec:



http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#compositing

I can't provide you with actual working code (your use case is quite rare), but you should find the globalComposite tutorials and with a little reproduction with your code you can learn how to apply the operation for your case.

+1


source







All Articles