How can I use clipTo with an image or SVG? I want to restrict any objects from going beyond the SVG shape outline / image outline.
I'm trying to accomplish something similar to this OP, however the responses did not seem clear to me how to accomplish this.
I can use clipTo with regular a shape, for example:
var circle = new fabric.Circle({
radius: 150,
stroke: '#f55',
fill: "transparent",
top: 50,
left: 50
});
circle.selectable = false;
canvas.add(circle);
canvas.clipTo = function (ctx) {
circle.render(ctx);
};
See this fiddle for working example: http://jsfiddle.net/o9f4dqjn/1/
However I can't get this to work with an image. Is this possible?