Cant load dark pixels from BMP ???
Hi
I got a really wierd problem whit my BMP loaders they cant load too dark pixels! I mean color RGB(60,60,60) is ok but RGB(20,20,20) is too dark to load and the color shows incorrectly.
Im really confused and dont have a glue what is causing this, any ideas?
this sounds like you are trying to load the wrong bitdepth or something, it would help if you''d show us the loading code
My Homepage
My Homepage
Here comes the full code:
[edited by - Craazer on March 19, 2003 3:23:31 PM]
void Istream_Read(fstream& hfile,LPVOID wbuffer,int size){ hfile.read(reinterpret_cast<char*>(wbuffer),size);}int LoadBitmapFile(char *filename,int offset){fstream file;int padding;file.open(filename, ios::in | ios::binary);if(file.fail() ) return(0);file.seekg(offset,ios::cur);Istream_Read(file,&bitmap.bitmapfileheader,sizeof(BITMAPFILEHEADER));// test if this is a bitmap fileif (bitmap.bitmapfileheader.bfType!=0x4D42) { file.close(); return(0); } // end ifIstream_Read(file,&bitmap.bitmapinfoheader,sizeof(BITMAPINFOHEADER));bitmap.sizeof_image = bitmap.bitmapfileheader.bfSize - bitmap.bitmapfileheader.bfOffBits;padding = 4 - ((bitmap.bitmapinfoheader.biWidth * 3) % 4); if(padding == 4) padding = 0;if(bitmap.bitmapinfoheader.biBitCount==24){int index;if(bitmap.buffer) delete [] bitmap.buffer; bitmap.buffer = new BYTE[bitmap.bitmapinfoheader.biSizeImage];index=0;for(int y=(bitmap.bitmapinfoheader.biHeight-1);y >= 0; y--){for(int x=0;x < (bitmap.bitmapinfoheader.biWidth*3); x+=3){ index = y * (bitmap.bitmapinfoheader.biWidth*3) + x; Istream_Read(file,&bitmap.buffer[index+2],1); Istream_Read(file,&bitmap.buffer[index+1],1); Istream_Read(file,&bitmap.buffer[index+0],1);}file.seekg(padding,ios::cur);}} // end if 24bitelsereturn 0;file.close();return(1);} // end Load_Bitmap_File
[edited by - Craazer on March 19, 2003 3:23:31 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement