Can Ti.Paint load Blob as background ?

You must Login before you can answer or comment on any questions.

Hi, I have a question. I can put an image form a file to Ti.Paint. sample code like this, var paintView = Ti.Paint.createPaintView({ image : '/images/djsp.jpeg', top : 0, right : 0, bottom : 0, left : 0, }); Ti.Paint can show the image.

But When I use a Blob to Ti.Paint, the Ti.Paint can not show the image. sample code like this, var paintView = Ti.Paint.createPaintView({ image : blob, top : 0, right : 0, bottom : 0, left : 0, });

Please help me, Thanks very much!

Tony

— asked 2 years ago by Tony Wu
0 Comments

2 Answers

I'm not sure is possible, but you always can save the blob and pass the nativePath to the image property.

— answered 2 years ago by Dan Tamas
answer permalink
3 Comments
  • This method (mentioned by Dan) is probably your best bet.

    — commented 2 years ago by Tony Guntharp

  • Thanks Dan vary much. I use a way to solve the problem. the sample code likes this,

    var filename = Titanium.Filesystem.applicationDataDirectory + "/image.jpg"; var img = Titanium.Filesystem.getFile(filename); img.write( blob );

    Ti.Paint.createPaintView({ image : filename, top : 0, right : 0, bottom : 0, left : 0 });

    I will try your way, when I have more time. Thanks your help very much.

    — commented 2 years ago by Tony Wu

  • It's almost the way I suggested, so if it works for is great :)

    — commented 2 years ago by Dan Tamas

Your Answer

Think you can help? Login to answer this question!