{"action":"created","issue":{"url":"https://api.github.com/repos/HaxeFoundation/format/issues/26","labels_url":"https://api.github.com/repos/HaxeFoundation/format/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/format/issues/26/comments","events_url":"https://api.github.com/repos/HaxeFoundation/format/issues/26/events","html_url":"https://github.com/HaxeFoundation/format/issues/26","id":91381470,"number":26,"title":"Bitmap format issues","user":{"login":"azrafe7","id":1266447,"avatar_url":"https://avatars.githubusercontent.com/u/1266447?v=3","gravatar_id":"","url":"https://api.github.com/users/azrafe7","html_url":"https://github.com/azrafe7","followers_url":"https://api.github.com/users/azrafe7/followers","following_url":"https://api.github.com/users/azrafe7/following{/other_user}","gists_url":"https://api.github.com/users/azrafe7/gists{/gist_id}","starred_url":"https://api.github.com/users/azrafe7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azrafe7/subscriptions","organizations_url":"https://api.github.com/users/azrafe7/orgs","repos_url":"https://api.github.com/users/azrafe7/repos","events_url":"https://api.github.com/users/azrafe7/events{/privacy}","received_events_url":"https://api.github.com/users/azrafe7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-26T22:58:56Z","updated_at":"2015-06-30T19:17:10Z","closed_at":null,"body":"While trying to use it I've stumbled upon some flaws in the current implementation that I think should be   addressed (I recognize this isn't a popular/efficient format - png is much better f.e. -, but still...).\r\n\r\nThe main thing is that the code doesn't account for padded width, it just copies the bytes over in chunks of 4, which could result in banded images when written out.\r\n(https://msdn.microsoft.com/en-us/library/windows/desktop/dd318229(v=vs.85).aspx and https://en.wikipedia.org/wiki/BMP_file_format#Bitmap_file_header)\r\n\r\n![out_xing_b24 bmp](https://cloud.githubusercontent.com/assets/1266447/8388818/90c4bb84-1c67-11e5-84f5-7a27cb9f5c85.png)\r\n\r\nNow... I have a half-baked PR for fixing this, but there's still some grey areas for which I'd like some pointers:\r\n - my _eventual_ PR of `format.bmp.Data.Header` contains a `bpp` and `paddedWidth` fields for further consumption\r\n - `Data.pixels` would be in BGR order with padded bytes (so raw bytes with padded ones)\r\n - both `format.bmp.Writer` and `format.bmp.Tools` would have to change, to account for padded bytes (and reverse the bytes order - RGB instead of BGR)\r\n - I'd imagine some `build/extract()` methods as in png (maybe reuse them and make them into a _global_ utility class?)"},"comment":{"url":"https://api.github.com/repos/HaxeFoundation/format/issues/comments/117310998","html_url":"https://github.com/HaxeFoundation/format/issues/26#issuecomment-117310998","issue_url":"https://api.github.com/repos/HaxeFoundation/format/issues/26","id":117310998,"user":{"login":"ncannasse","id":1022912,"avatar_url":"https://avatars.githubusercontent.com/u/1022912?v=3","gravatar_id":"","url":"https://api.github.com/users/ncannasse","html_url":"https://github.com/ncannasse","followers_url":"https://api.github.com/users/ncannasse/followers","following_url":"https://api.github.com/users/ncannasse/following{/other_user}","gists_url":"https://api.github.com/users/ncannasse/gists{/gist_id}","starred_url":"https://api.github.com/users/ncannasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncannasse/subscriptions","organizations_url":"https://api.github.com/users/ncannasse/orgs","repos_url":"https://api.github.com/users/ncannasse/repos","events_url":"https://api.github.com/users/ncannasse/events{/privacy}","received_events_url":"https://api.github.com/users/ncannasse/received_events","type":"User","site_admin":false},"created_at":"2015-06-30T19:17:10Z","updated_at":"2015-06-30T19:17:10Z","body":"The common format to represent pixels is BGRA stored in low endian (so bytes in BGRA order). But maybe i should make it more explicit by taking the hxd.Pixels class from Heaps.io and porting it to format, but then it's tight to hxd.BitmapData, etc. https://github.com/ncannasse/heaps/blob/master/hxd/Pixels.hx"}}