【发布时间】:2016-07-24 03:36:01
【问题描述】:
我需要将位图图像转换为纹理。因此,我正在编写用于解析位图的 c 代码。我能够解析位图 rgb 数据并显示它。但是颜色不正确。 它的 32 位图像。(ARGB)
int pixels = width * height * 4;
unsigned char* data = new unsigned char[pixels];
const int row = width * 4;
const int colomn = height;
unsigned char* datarow = new unsigned char[row];
unsigned char data1[pixels];
#if 1
fseek(f, 54,SEEK_SET);
fread(data, sizeof(unsigned char), pixels, f);
fclose(file);
#endif
for(int i = 0; i < colomn; i++) {
for(int j = 0; j < row; j++)
{
data1[j+i*row] = data[j+((colomn-i)*row)];
}
}
【问题讨论】:
标签: c bitmap bitmapdata