'Can we add a SVG object to a canvas in fabricjs as vector image - not pixel
Of course I have read similar questions before asking. The most answers are about how to read SVG, turn it into pixel image and then add it to canvas.
My question is: how can we create an object and put it into a canvas so it stays a vector object, not turning into pixels?
For example we can easily create a line using fabricjs and add it to canvas:
var blackLine = new fabric.Line([10, 10, 100, 100], {
stroke: 'black'
});
function createCanvas(id){
canvas = new fabric.Canvas(id);
canvas.add(blackLine);
return canvas;
}
It there a way to do something like (let's imagine):
var line = newSVG.Line([x1, y1, x2, y2])
canvas.add(line);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
