I am working on canvas and using EaselJS library to play along. With EaselJS, I am able to apply the ColorMatrix using Filters
const myGraphics = new createjs.Shape();
myGraphics.graphics.bf(img, 'no-repeat')
.drawCircle(x, y, cursorSize);
const colorMatrix = [0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0, 0, 0, 1, 0];
const blurFilter = new createjs.BlurFilter(5, 5, 1);
myGraphics.filters = [new createjs.ColorMatrixFilter(colorMatrix), blurFilter];
myGraphics.cache(0, 0, 500, 500);
Can the same be applied without using EaselJS ? I have the below code
const patt = ctx.createPattern(img, 'no-repeat');
ctx.filter = 'blur(5px)';
ctx.fillStyle = patt;
ctx.beginPath();
ctx.arc(x, y, r1, 0, Math.PI * 2);
ctx.fill();
How can I apply the colorMatrix filter to the above canvas context?
Thanks in advance