现在有一点脑残,但我需要帮助将图像从ARGB1555转换为RGB8888。
我已经有了遍历每个像素的循环(本质上是从文件中读取u16s ),我想将它们存储为u32。我想我只需要使用一些二元运算符来获得2-6、7-11和12-16位,然后使用另一个运算符以某种方式将每种颜色更改为它们各自的RGB8888值……但我真的不知道该怎么做。
发布于 2011-06-01 07:05:15
您没有说明用什么语言编写它,但这里有一个用于它的C++函数:它接受ARGB1555中的16位整数,并返回ARGB8888中的32位整数
unsigned int ARGB1555toARGB8888(unsigned short c)
{
const unsigned int a = c&0x8000, r = c&0x7C00, g = c&0x03E0, b = c&0x1F;
const unsigned int rgb = (r << 9) | (g << 6) | (b << 3);
return (a*0x1FE00) | rgb | ((rgb >> 5) & 0x070707);
}参考:http://cboard.cprogramming.com/c-programming/118698-color-conversion.html
https://stackoverflow.com/questions/6194449
复制相似问题