Why do my images seem to be in the format of Bgra instead of Argb?

风流意气都作罢 提交于 2019-12-05 18:13:39

Not only are the colors reversed BGRA, but the rows are reversed as well - the bottom of the image is the first in memory. It's just the way Windows has always worked.

The little-endian explanation seems obvious, but I don't think it's the truth. If you look at the definition of COLORREF in the Windows API, you'll notice that Red is the low order byte and Blue is the higher order; if you stored this as a single integer value, it would be RGB0.

ARGB refers to the byte order in words fetched as words. If you fetch the bytes one at a time, you'll receive em low to hi as IBM PC's are little-endian

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!