mAm
mAm

Reputation: 167

HTML5 Canvas bitmap masks & drawing bitmaps

Had hard time finding any info regarding this. I want to place a main bitmap on canvas (jpg,png) also want to place a bitmap file that is going to perform as a mask of the main bitmap. Further I would wish to continue drawing on this mask-bitmap so that masking will provide sort of eraser feature.

I would be more than happy with links to more reading. Thanks

Upvotes: 2

Views: 1736

Answers (1)

Nobita
Nobita

Reputation: 23713

I don't know about the erase function, but I can point you to Canvas-Mask because I have used it.

It's based on the Alpha Compositing process. It reads the alpha data from one image and put it into another picture. Basically the result you it's a merge between the RGB values from the base image and the A values of the mask image.

It's pretty simple but it might be a base for what you want to achieve.

Upvotes: 3

Related Questions