{"action":"created","issue":{"url":"https://api.github.com/repos/sksamuel/scrimage/issues/91","labels_url":"https://api.github.com/repos/sksamuel/scrimage/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/sksamuel/scrimage/issues/91/comments","events_url":"https://api.github.com/repos/sksamuel/scrimage/issues/91/events","html_url":"https://github.com/sksamuel/scrimage/issues/91","id":97266005,"number":91,"title":"AwtImage.rotate - suggested changes","user":{"login":"Hivemind9000","id":4607635,"avatar_url":"https://avatars.githubusercontent.com/u/4607635?v=3","gravatar_id":"","url":"https://api.github.com/users/Hivemind9000","html_url":"https://github.com/Hivemind9000","followers_url":"https://api.github.com/users/Hivemind9000/followers","following_url":"https://api.github.com/users/Hivemind9000/following{/other_user}","gists_url":"https://api.github.com/users/Hivemind9000/gists{/gist_id}","starred_url":"https://api.github.com/users/Hivemind9000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hivemind9000/subscriptions","organizations_url":"https://api.github.com/users/Hivemind9000/orgs","repos_url":"https://api.github.com/users/Hivemind9000/repos","events_url":"https://api.github.com/users/Hivemind9000/events{/privacy}","received_events_url":"https://api.github.com/users/Hivemind9000/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-25T23:21:24Z","updated_at":"2015-07-28T20:33:34Z","closed_at":null,"body":"Just a suggestion. The rotate function is not exposed (in the Image class), and when I did expose it, it didn't work that well (it seemed to rotate around an arbitrary coordinate). My preference was that it rotated about the center of the image by default (like your rotateLeft and rotateRight methods). After a bit of investigation, the following code handles the rotateLeft and rotateRight as well as other angles.\r\n\r\nAlso, changed the \"in degrees\" to \"in radians\", and also the parameter from \"angle\" to \"radians\" (which helps with understanding the method requirements without having to read the code).\r\n\r\nCheers,\r\n\r\nDarren\r\n\r\n```\r\n/**\r\n   * Returns a new AWT Image rotated with the given angle (in radians)\r\n   */\r\n  protected[scrimage] def rotate(radians: Double): BufferedImage = {\r\n    val target = new BufferedImage(height, width, awt.getType)\r\n    val g2 = target.getGraphics.asInstanceOf[Graphics2D]\r\n    g2.translate(width / 2, height / 2)\r\n    g2.rotate(radians)\r\n    g2.translate(- width / 2, - height / 2)\r\n    g2.drawImage(awt, 0, 0, null)\r\n    g2.dispose()\r\n    target\r\n  }\r\n```"},"comment":{"url":"https://api.github.com/repos/sksamuel/scrimage/issues/comments/125745983","html_url":"https://github.com/sksamuel/scrimage/issues/91#issuecomment-125745983","issue_url":"https://api.github.com/repos/sksamuel/scrimage/issues/91","id":125745983,"user":{"login":"sksamuel","id":743706,"avatar_url":"https://avatars.githubusercontent.com/u/743706?v=3","gravatar_id":"","url":"https://api.github.com/users/sksamuel","html_url":"https://github.com/sksamuel","followers_url":"https://api.github.com/users/sksamuel/followers","following_url":"https://api.github.com/users/sksamuel/following{/other_user}","gists_url":"https://api.github.com/users/sksamuel/gists{/gist_id}","starred_url":"https://api.github.com/users/sksamuel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sksamuel/subscriptions","organizations_url":"https://api.github.com/users/sksamuel/orgs","repos_url":"https://api.github.com/users/sksamuel/repos","events_url":"https://api.github.com/users/sksamuel/events{/privacy}","received_events_url":"https://api.github.com/users/sksamuel/received_events","type":"User","site_admin":false},"created_at":"2015-07-28T20:33:34Z","updated_at":"2015-07-28T20:33:34Z","body":"Thanks for the suggestion. When I try using this code, the translation of the rotateLeft and rotateRight gets messed up. You can see that in the ImageTest if you want to try."}}