KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

How to create image mask with png

Open michaelDotco2 opened this issue 10 years ago • 1 comments

Is it possible to create an image mask with a transparent png treating the transparent areas as not part of the "shape" to mask. Eg an alpha mask.

michaelDotco2 avatar Jul 08 '14 16:07 michaelDotco2

According to me, there are two solutions :

  1. drawHitFromCache Just cache your image and call drawHitFromCache.
  2. Do it yourself with hitFunc http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-custom-hit-function-tutorial/ You just have to play with context and getImageData, putImageData

pfautrero avatar Jul 21 '14 12:07 pfautrero