How to paint on canvas in javascript with alphamask?
I have a png image with white edges. I would like to make the edges transparent.
Is there a way to specify a color to be not painted - like a color key or alphamask.
Are there any examples?
For example this image has white edges, and I would like to paint two of them close to eachother without the white.
alt text http://sketchup.google.com/3dwarehouse/download?mid=4a51b1bfaba开发者_Python百科674b2ca42c60e697162c&rtyp=st&ctyp=other&ts=1202486187000
How can I do that in javascript with canvas?
See globalCompositeOperation, or draw it in another canvas,remove white pixels (getImageData, if white, make it transparent) and putImageData of the new array to your canvas.
Convert the image to GIF format? GIF allows any single colour value to represent transparent pixels.
精彩评论