{ "id": "79853", "key": "TIMOB-5177", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "12078", "description": "", "name": "Sprint 2011-38", "archived": true, "released": true, "releaseDate": "2011-09-26" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-09-26T15:17:32.000+0000", "created": "2011-08-30T14:06:07.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "imageview", "merged-v8", "parity", "scale", "stage" ], "versions": [ { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2011-10-31T22:40:48.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Given the attached large photo \"julia.jpg\" and the following app.js:\r\n\r\n{code:title=app.js}\r\nTitanium.UI.setBackgroundColor('#000');\r\nvar win = Titanium.UI.createWindow({\r\n\ttitle : 'Test',\r\n\tbackgroundColor : '#000',\r\n\texitOnClose : true\r\n});\r\n\r\nvar img = Ti.UI.createImageView({\r\n\timage : \"julia.jpg\",\r\n\ttop : 0,\r\n\tleft : 0,\r\n\twidth : \"300dp\",\r\n\theight : \"100dp\",\r\n\tbackgroundColor : \"red\"\r\n});\r\n\r\nwin.add(img);\r\nwin.open();\r\n{code}\r\n\r\nThe aspect ratio of the image (w/h) is 0.75. The aspect ratio of the created ImageView is 3.0. If you run the app in iOS, you'll see that iOS makes a \"best fit\" for image, being sure to display all of it *and* at the correct aspect ratio. Our Android implementation, on the other hand, will stretch to fit the entirety of the ImageView, meaning it forces the 0.75 aspect ratio photo into a 3.0 aspect ratio, causing it to stretch horizontally and look bad.", "attachment": [ { "id": "22730", "filename": "julia.jpg", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-08-30T14:09:13.000+0000", "size": 739261, "mimeType": "image/jpeg" }, { "id": "23001", "filename": "timob5177.zip", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-09-21T15:52:23.000+0000", "size": 2356828, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android: scaled images in ImageView are stretched if aspect ratio of view doesn't match source image.", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "166575", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "Testing notes:\r\n\r\nThe attached ugly test app (timob5177.zip) simply shows that when the aspect ratio of the bitmap and its containing ImageView are different, you get a best fit that preserves the original ratio. This is Android's \"CENTER_FIT\" mode which is the default. A later ticket will allow for other options.\r\n\r\nThe bottom image in the test app simply shows that if you set the dimensions to \"auto\", you get what you'd expect: ImageView same size as scaled bitmap, aspect ratio preserved.\r\n\r\nAdditionally test KitchenSink ImageView tests and TableView layout tests.", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-09-21T15:52:23.000+0000", "updated": "2011-09-21T15:53:05.000+0000" }, { "id": "166581", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "Pull request ready:\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/pull/485", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-09-21T16:34:16.000+0000", "updated": "2011-09-21T16:34:16.000+0000" }, { "id": "167027", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "test, review, merge.", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-26T15:17:32.000+0000", "updated": "2011-09-26T15:17:32.000+0000" }, { "id": "169270", "author": { "name": "avaghti", "key": "avaghti", "displayName": "Alan Vaghti", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing.\r\n\r\nFix verified on Nexus One 2.2.2 with SDK 1.8.0.v20111013161411", "updateAuthor": { "name": "avaghti", "key": "avaghti", "displayName": "Alan Vaghti", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-10-13T16:19:54.000+0000", "updated": "2011-10-13T16:19:54.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }