Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4524] iOS: 3DMatrix toImage does not capture transformation

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2011-07-27T14:33:07.000+0000
Affected Version/sRelease 1.7.1
Fix Version/sSprint 2011-30
ComponentsiOS
Labelsn/a
ReporterAlan Leard
AssigneeSabil Rahim
Created2011-06-29T12:46:34.000+0000
Updated2017-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();

Comments

  1. Sabil Rahim 2011-07-27

    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.
  2. Lee Morris 2017-03-07

    Closing ticket as it will not fix.

JSON Source