Problem
Saving an image to the filesystem using toImage() method, does not keep the transparent property of the image
Steps to reproduce
See attached code
var window = Ti.UI.createWindow({
backgroundColor:'#ff0'
});
var view = Ti.UI.createImageView({
image:'KS_nav_ui.png',
// var view = Ti.UI.createView({
backgroundColor:'transparent',
borderWidth:2,
borderColor:'#f00',
width:100,
height:100,
top:10
});
window.add(view);
var image = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'tst.png');
image.write(view.toImage());
var img = Ti.UI.createImageView({
width:200,
height:200,
bottom:10,
image:image.nativePath
});
window.add(img);
window.open();
Link
Ticket :
http://support-admin.appcelerator.com/display/APP-785915
I'm thinking on 2 cases: 1. The image is saved jpg as the background color goes always white. 2. It can be fixed as I specified in the ticket by altering the write method in ToBlob.m
Closing bug. Verified fix on: SDK build: 2.0.0.v20120315140247 Titanium Studio, build: 2.0.0.201203142055 xcode: 4.2 Device: iphone 4s (5.0.1)