{ "id": "152260", "key": "TIMOB-19767", "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": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-11-26T08:54:54.000+0000", "created": "2015-10-22T18:10:55.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "ios", "retina", "scale", "toimage" ], "versions": [ { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" }, { "id": "14826", "description": "Release 5.1.0-remaining iOS9 features, Android M features", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-11-20" }, { "id": "16925", "description": "WatchKit Support--all going into 5.0 now", "name": "Release 5.0.0", "archived": true, "released": true, "releaseDate": "2015-09-16" } ], "issuelinks": [ { "id": "49923", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "124073", "key": "TIMOB-16056", "fields": { "summary": "Change default for toImage honorScaleFactor to true", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-01-15T18:04:46.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "We used to have a {{honorScaleFactor}} property, that was removed as part of the 4.0.0.GA release in [this PR|https://github.com/appcelerator/titanium_mobile/pull/6302] around changes with non-attached images. The [docs|http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ImageView-method-toImage] say, the property was already removed in 3.5.0, but worked until 3.5.1.GA. I would like to get this property back to achieve a proper behavior in the following use case.\r\n\r\n*Use case*: Use {{toImage()}} to make an image (blob) of a view, that covers a specified square inside another view.\r\n\r\n*Demo:*\r\n{code:javascript}\r\nvar win1 = Titanium.UI.createWindow({\r\n\tbackgroundColor : '#fff'\r\n});\r\n\r\nvar imageView = Ti.UI.createImageView({\r\n\timage : \"test.jpg\"\r\n});\r\n\r\nimageView.addEventListener(\"click\", imageViewClicked);\r\n\r\nwin1.add(imageView);\r\nwin1.open();\r\n\r\nfunction imageViewClicked(e) {\r\n\timageView.removeEventListener(\"click\", imageViewClicked);\r\n\r\n\tvar edgeLength = 100;\r\n\tvar blob = imageView.toImage();\r\n\r\n\tvar tempView = Ti.UI.createView({\r\n\t\twidth : blob.width + edgeLength,\r\n\t\theight : blob.height + edgeLength\r\n\t});\r\n\r\n\ttempView.add(Ti.UI.createImageView({\r\n\t\timage : blob,\r\n\t\twidth : blob.width,\r\n\t\theight : blob.height\r\n\t}));\r\n\r\n // No callback -> get blob directly, honorScaleFactor false -> Same size for retina and non-retina\r\n // Default functionality still the same: No callback and secons argument true / undefined -> Different size for retina and non-retina\r\n\tblob = tempView.toImage(null, false);\r\n\r\n\tvar image = blob.imageAsCropped({\r\n\t\twidth : edgeLength,\r\n\t\theight : edgeLength,\r\n\t\tx : e.x,\r\n\t\ty : e.y\r\n\t});\r\n\r\n\tvar croppedImageView = Ti.UI.createImageView({\r\n\t\timage : image,\r\n\t\tbottom : 0,\r\n\t\tborderWidth : 1,\r\n\t\tborderColor : \"black\",\r\n\t\tborderRadius : edgeLength / 2\r\n\t});\r\n\r\n\tcroppedImageView.addEventListener(\"click\", function() {\r\n\t\twin1.remove(croppedImageView);\r\n\t\timageView.addEventListener(\"click\", imageViewClicked);\r\n\t});\r\n\r\n\twin1.add(croppedImageView);\r\n}\r\n{code}\r\n\r\n*Expected behavior*: The method works same on retina and non-retina devices.\r\n*Actual behavior:* The method uses the wrong scale on creating the image blob.\r\n\r\n*Proposal*: Bring back the {{honorScaleFactor}} property, make the default value to {{true}} as the current behavior expects. That would achieve the configuration of the property, but would not break any existing applications.\r\n", "attachment": [ { "id": "57107", "filename": "Actual.png", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-10-22T18:30:00.000+0000", "size": 61508, "mimeType": "image/png" }, { "id": "57106", "filename": "Expected.png", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-10-22T18:30:00.000+0000", "size": 63258, "mimeType": "image/png" }, { "id": "57105", "filename": "test.jpg", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-10-22T18:27:29.000+0000", "size": 18647, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "iOS: toImage does not honor the scale factor for retina devices", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 536, "state": "closed", "name": "2015 Sprint 25 SDK", "startDate": "2015-12-05T01:30:40.415Z", "endDate": "2015-12-19T01:30:00.000Z", "completeDate": "2015-12-29T03:19:42.127Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "371289", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FT passed , PR approved. Thanks Hans! ", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-24T01:10:03.000+0000", "updated": "2015-11-24T01:10:03.000+0000" }, { "id": "374701", "author": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "updateAuthor": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "created": "2016-01-15T18:04:38.000+0000", "updated": "2016-01-15T18:04:38.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }