[TIMOB-4524] iOS: 3DMatrix toImage does not capture transformation
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2011-07-27T14:33:07.000+0000 |
Affected Version/s | Release 1.7.1 |
Fix Version/s | Sprint 2011-30 |
Components | iOS |
Labels | n/a |
Reporter | Alan Leard |
Assignee | Sabil Rahim |
Created | 2011-06-29T12:46:34.000+0000 |
Updated | 2017-03-07T19:54:45.000+0000 |
Description
If you load an image and then transform it with a 3Dmatrix and then try to save the new image, the image is saved as the original. Using the exact same code but using 2Dmatrix, it works as expected.
var win = Titanium.UI.createWindow({
backgroundColor:'#fff'
});
var view = Ti.UI.createView({width:'auto', height:'auto'});
var img = Titanium.UI.createImageView({
height:43,
width:98,
top:10,
image:'KS_nav_ui.png', //image file
transform:Ti.UI.create3DMatrix().rotate(180, 0, 1, 0),
//transform:Ti.UI.create2DMatrix().rotate(180, 0, 1, 0),
preventDefaultImage: false
});
view.add(img);
win.add(view);
var save = Titanium.UI.createButton({
title:'Save',
width:120,
height:40,
bottom:20,
right:0,
});
save.addEventListener('click', function()
{
alert('File saved here: '+Titanium.Filesystem.applicationDataDirectory);
// file system
var photoname= new Date().getTime()+".png";
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,photoname);
f.write(view.toImage());
});
win.add(save);
win.open();
At present there is no way for capturing 3D transformation in iPhone natively. The method currently being used to capture the view is renderInContext and this will not recognize the 3D transformation applied to the image. the related documentation is : http://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004500-CH1-SW120 There seems to ba no other alternative to this and hence cannot be fixed.
Closing ticket as it will not fix.