[TIMOB-27997] iOS: Ti.Blob images from device (via Ti.UI.View#toImage()) would report dimensions in points, not pixels
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-08-06T10:21:31.000+0000 |
Affected Version/s | Release 9.0.3 |
Fix Version/s | Release 9.1.0 |
Components | iOS |
Labels | parity |
Reporter | Christopher Williams |
Assignee | Christopher Williams |
Created | 2020-07-02T20:35:42.000+0000 |
Updated | 2021-02-11T10:45:35.000+0000 |
Description
On Android, if we generate a Ti/Blob image from calling Ti.UI.View#toImage(), it reports width/height/size properly.
On iOS, it will report width and height in points, not pixels. size is therefore also incorrect.
Say we have a 10px x 10px view rendered to image on a 3x scale device. The blob will report width of 3, height of 3 and size of 9. The device will report density factor of 3. So naively multiple by that still gives us wrong values (of 9, 9, 81 respectively instead of 10, 10, 100).
UIImage holds a scale value for cases like this and we should multiply width/height by that on iOS to get true pixel values. (Doing so in this case we actually do end up with 10, 10, 100 because presumably the image scale is recorded as something like 3.3333?)
https://github.com/appcelerator/titanium_mobile/pull/11803
FR Passed, waiting on Jenkins build.
Merged to master for 9.1.0 target
Fix verified on build 9.1.0.v20200804082025. Closing ticket.