Advertisement

Writing a bitmap

Started by February 05, 2000 02:34 PM
2 comments, last by ThaUnknownProgga 25 years, 1 month ago
Right now I am trying to write a program that will write a bitmap. I am currently having trouble writing a 16 bit bitmap to a 24 bit bitmap-file. It writes the bitmap in the write color depth and everything, except near the bottom of the thing is this big band of color bars. it's like it tints the image, and skews it too. So as it goes through these color bars it moves stuff over. Here are some before and after shots: before after (it's kinda hard to see the skewing because the image is tileable, but look closely at the white sections at the top) I have the bitmap loaded onto a surface, and here's the code i am using to write the bitmap:

//Height, Width, and Pitch gotten properly as ints
//outpixel is of type DWORD
//outbyte is of type int
//WriteBuffer is a BYTE * that I finish by
//dumping all into a WriteFile call

BYTE *Bitmap_in = (BYTE*)ddsd.lpSurface;
if (ddsd .ddpfPixelFormat.dwGBitMask ==  0x07E0)  //if 565
{
for (loop =Height-1;loop>=0;loop--)                       for (loop2=0;loop2>5)&0x003f)); 
WriteBuffer [BufferIndex++] = outbyte;
outbyte = (8*((outpixel>>11)&0x001f));
WriteBuffer [BufferIndex++] = outbyte;
}
}
 
Please help me, this has been chewing on my brain for a while now!
Edited by - ThaUnknownProgga on 2/5/00 2:41:50 PM
I''m bumping this because I spent the day working on this problem and made absolutely no progress. I was wondering a new question: how do i define the ddsd.ddpfPixelFormat.dwRBitMask and dwBBitMask and dwGBitMask for a 16/24/32 bit surface?
Advertisement
I don''t know about the bitmap problem, but as far as the bit masks go, I don''t think you are supposed to assign those... You create your surface at whatever bit depth you want to, and then you can call GetPixelFormat() to fill in those values for you, then you get the pixel formats from that. But, as far as I know, you aren''t supposed to set those. But I could be wrong...

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
What sort of pointer (what size) is BufferIndex???

This topic is closed to new replies.

Advertisement