0

I'm attempting to clip an image object using an SVG object, but the SVG object is added to the bottom right of the image, hiding all of the image.

What is the correct way to clip the image using an SVG object (or any object) ?

var cnvs = getElementByID('myCanvas');
var ctx = cnvs.getContext("2d");
var maskPath = cnvs.item(0);
var img = cnvs.item(1);

cnvs.remove(maskPath);
img.clipTo = function(ctx) {
    maskPath.render(ctx);
}

1 Answers1

0

I believe the solution you are looking for can be found on this discussion: Multiple clipping areas on Fabric.js canvas

Community
  • 1
  • 1
PromInc
  • 1,174
  • 7
  • 12