maskify = function(maskInput, canvasImage) {
let w = canvasImage.width
let h = canvasImage.height
let canvas = DOM.canvas(w, h);
let context = canvas.getContext("2d");
let maskColor = "black"
let backgroundColor = "white"
function render() {
context.clearRect(0, 0, w, h);
context.fillStyle = backgroundColor;
context.fillRect(0, 0, w, h)
context.lineWidth = 10;
context.lineCap = "round"
context.fillStyle = maskColor
maskInput.forEach(stroke => {
stroke.forEach(p => {
context.beginPath()
context.arc(p[0], p[1], maskInput.strokeWidth, 0, Math.PI * 2)
context.fill()
})
})
}
canvas.style.border = "solid 1px #ccc";
render();
return canvas;
}