I have a line as shown below
Line attributes are When I convert it to image using following code,
var nClone=$scope.currLine.clone(); // $scope.currLine has kinetic line info
$scope.currLine.remove(); // remove form layer as we have its clone
var pArr=nClone['attrs']['points'];
var i,wIs,hIs;
var xIs=0;
var yIs=0;
// to set width and height of image from line points
var arrLen=pArr.length;
for(i=0; i<arrLen;i){
if(i>=arrLen){
break;
}
wIs=Math.abs(pArr[i]-pArr[i+2]); // calculating difference
hIs=Math.abs(pArr[i+1]-pArr[i+3]);
i=i+4;
}
nClone.toImage({
x:xIs,
y:yIs,
width:wIs,
height:hIs,
callback: function(graphicImage){
console.log(graphicImage.src);
}
});
The image that I get is
I have tried a lot to set the line at 0,0 position any suggestion? Thanks