Hi, i want to do undo operations in paintview so i can set multiple images in a paintview but when i set image in a paintview i get following error
<Error>:CGContextSaveGState: invalid context 0x0 <Error>: CGContextSetBlendMode: invalid context 0x0 <Error>: CGContextSetAlpha: invalid context 0x0 <Error>: CGContextTranslateCTM: invalid context 0x0 <Error>: CGContextScaleCTM: invalid context 0x0
through user questions i have used to save file in a Application directory. get image from it but again i got this error.
paintView.addEventListener('touchend',function(e) { paintimage = paintView.toImage(); imagearray.push(paintimage);
// var filename = imagearrayval+"savedPainting.jpg";
savePaintImage(paintimage,filename);
});
var savePaintImage = function(imageBlob,filename) { var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename); file.write(imageBlob); }
var getPaintImage = function(imagearrayval)
{
var getfilename = imagearrayval+"savedPainting.jpg";
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,getfilename);
if(!file.exists()){
return 'File not found.';
} else {
return Titanium.Filesystem.applicationDataDirectory+getfilename;
}
}
i get image by calling getPaintImage() method
var file = getPaintImage(imagearrayval);
Your Answer
Think you can help? Login to answer this question!