Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Change/Bug in Universal Unit Support in Titanium SDK 4.0.0?

$
0
0

I noticed a strange difference in behavior between Titanium SDK 3.5.1 and Titanium SDK 4.0.0 in iOS when it comes to images that are created from a view and then saved to the device's file system.

In the code example below, Ti SDK 3.5.1 produces an image file that is 240 dp x 320 dp, which is my desired outcome; in Ti SDK 4.0.0 however, the image that is created is 240 px x 320 px (i.e., 720 x 960 when created on iPhone 6 Plus):

In /tiapp.xml

...
<property name="ti.ui.defaultunit" type="string">dp</property>
...

In /app/views/index.xml

<Alloy>
 
...
 
   <View id="lgImageContainer" width="240" height="320">
      <ImageView id="lgImageMaker" width="240" height="620"/>
   </View>
 
...
 
</Alloy>

In /app/controllers/index.js

...
 
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'INPUT.jpg').read();
$.lgImageMaker.image = f;
var b = $.lgImageContainer.toImage();
var m = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'OUTPUT.png');
m.write(b);
 
...
I can replicate the behavior described above 100% of the time simply by switching between SDK 3.5.1 and 4.0.0.

Have any of you seen this behavior, and if so, have you found a solution?


Viewing all articles
Browse latest Browse all 8068

Trending Articles