{"action":"created","issue":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5321","repository_url":"https://api.github.com/repos/openframeworks/openFrameworks","labels_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5321/labels{/name}","comments_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5321/comments","events_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5321/events","html_url":"https://github.com/openframeworks/openFrameworks/issues/5321","id":184069769,"number":5321,"title":"ofPixels::getColor(int index) is broken. ","user":{"login":"ofTheo","id":144000,"avatar_url":"https://avatars.githubusercontent.com/u/144000?v=3","gravatar_id":"","url":"https://api.github.com/users/ofTheo","html_url":"https://github.com/ofTheo","followers_url":"https://api.github.com/users/ofTheo/followers","following_url":"https://api.github.com/users/ofTheo/following{/other_user}","gists_url":"https://api.github.com/users/ofTheo/gists{/gist_id}","starred_url":"https://api.github.com/users/ofTheo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ofTheo/subscriptions","organizations_url":"https://api.github.com/users/ofTheo/orgs","repos_url":"https://api.github.com/users/ofTheo/repos","events_url":"https://api.github.com/users/ofTheo/events{/privacy}","received_events_url":"https://api.github.com/users/ofTheo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/openframeworks/openFrameworks/labels/bug","name":"bug","color":"b31d1d"},{"url":"https://api.github.com/repos/openframeworks/openFrameworks/labels/core","name":"core","color":"db6a1f"}],"state":"closed","locked":false,"assignee":{"login":"ofTheo","id":144000,"avatar_url":"https://avatars.githubusercontent.com/u/144000?v=3","gravatar_id":"","url":"https://api.github.com/users/ofTheo","html_url":"https://github.com/ofTheo","followers_url":"https://api.github.com/users/ofTheo/followers","following_url":"https://api.github.com/users/ofTheo/following{/other_user}","gists_url":"https://api.github.com/users/ofTheo/gists{/gist_id}","starred_url":"https://api.github.com/users/ofTheo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ofTheo/subscriptions","organizations_url":"https://api.github.com/users/ofTheo/orgs","repos_url":"https://api.github.com/users/ofTheo/repos","events_url":"https://api.github.com/users/ofTheo/events{/privacy}","received_events_url":"https://api.github.com/users/ofTheo/received_events","type":"User","site_admin":false},"assignees":[{"login":"ofTheo","id":144000,"avatar_url":"https://avatars.githubusercontent.com/u/144000?v=3","gravatar_id":"","url":"https://api.github.com/users/ofTheo","html_url":"https://github.com/ofTheo","followers_url":"https://api.github.com/users/ofTheo/followers","following_url":"https://api.github.com/users/ofTheo/following{/other_user}","gists_url":"https://api.github.com/users/ofTheo/gists{/gist_id}","starred_url":"https://api.github.com/users/ofTheo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ofTheo/subscriptions","organizations_url":"https://api.github.com/users/ofTheo/orgs","repos_url":"https://api.github.com/users/ofTheo/repos","events_url":"https://api.github.com/users/ofTheo/events{/privacy}","received_events_url":"https://api.github.com/users/ofTheo/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/milestones/12","html_url":"https://github.com/openframeworks/openFrameworks/milestones/0.10.0","labels_url":"https://api.github.com/repos/openframeworks/openFrameworks/milestones/12/labels","id":264335,"number":12,"title":"0.10.0","description":"","creator":{"login":"bilderbuchi","id":327442,"avatar_url":"https://avatars.githubusercontent.com/u/327442?v=3","gravatar_id":"","url":"https://api.github.com/users/bilderbuchi","html_url":"https://github.com/bilderbuchi","followers_url":"https://api.github.com/users/bilderbuchi/followers","following_url":"https://api.github.com/users/bilderbuchi/following{/other_user}","gists_url":"https://api.github.com/users/bilderbuchi/gists{/gist_id}","starred_url":"https://api.github.com/users/bilderbuchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bilderbuchi/subscriptions","organizations_url":"https://api.github.com/users/bilderbuchi/orgs","repos_url":"https://api.github.com/users/bilderbuchi/repos","events_url":"https://api.github.com/users/bilderbuchi/events{/privacy}","received_events_url":"https://api.github.com/users/bilderbuchi/received_events","type":"User","site_admin":false},"open_issues":124,"closed_issues":91,"state":"open","created_at":"2013-02-11T12:18:09Z","updated_at":"2016-10-20T17:56:42Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-10-19T20:47:13Z","updated_at":"2016-10-20T17:57:15Z","closed_at":"2016-10-20T17:56:42Z","body":"It looks like the index is not referring to the pixel index but incorrectly to the byte index. \r\nSo with a three or four channel image this doesn't work correctly. \r\n\r\n```\r\n            for(int d = 0; d < pix.size(); d++){\r\n                ofColor color = pix.getColor(d);\r\n            }\r\n```\r\n\r\nWhere any of the below does work correctly. \r\nI am pretty sure this is a bug, as we shouldn't be returning a color based on a byte index as the color spans multiple bytes. \r\n\r\n```\r\n            int numChannels = pix.getNumChannels();\r\n            int i = 0;\r\n            for(int d = 0; d < pix.size(); d++){\r\n                ofColor color = pix.getColor(i);\r\n                i+= numChannels;\r\n            }\r\n\r\n```\r\n\r\n```\r\n            for(int d = 0; d < pix.size(); d++){\r\n                \r\n                int x = d % pix.getWidth();\r\n                int y = d / pix.getWidth();\r\n                \r\n                ofColor color = pix.getColor(x,y);\r\n```\r\n\r\n\r\n```\r\n            for(auto line: pix.getLines()){\r\n                for(auto pixel: line.getPixels()){        \r\n                    ofColor color = pixel.getColor();\r\n                }\r\n            }\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/comments/255180245","html_url":"https://github.com/openframeworks/openFrameworks/issues/5321#issuecomment-255180245","issue_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/5321","id":255180245,"user":{"login":"arturoc","id":48240,"avatar_url":"https://avatars.githubusercontent.com/u/48240?v=3","gravatar_id":"","url":"https://api.github.com/users/arturoc","html_url":"https://github.com/arturoc","followers_url":"https://api.github.com/users/arturoc/followers","following_url":"https://api.github.com/users/arturoc/following{/other_user}","gists_url":"https://api.github.com/users/arturoc/gists{/gist_id}","starred_url":"https://api.github.com/users/arturoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arturoc/subscriptions","organizations_url":"https://api.github.com/users/arturoc/orgs","repos_url":"https://api.github.com/users/arturoc/repos","events_url":"https://api.github.com/users/arturoc/events{/privacy}","received_events_url":"https://api.github.com/users/arturoc/received_events","type":"User","site_admin":false},"created_at":"2016-10-20T17:57:15Z","updated_at":"2016-10-20T17:57:15Z","body":"just fixed this so it goes in 0.9.5"}}
{"actor":{"display_login":"arturoc"}}