c0c Subj : Re: Screen Capture function To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Sat Jul 03 2004 04:36 pm Jeff Baker wrote: >Well it's the strangest thing. The resulting bmp file looks as if it is >zoomed in and is only displaying every other pixel. Seeing the created file >makes me think that I'm not padding the data section of the file correctly. >I am unable to find information telling me if each pixel is represented by a >byte or an int but in either case the program captures the screen >identically. This leads me to believe that two or more pixels are contained >in a single byte/int. So I'll have to tinker with shifting a pixel left and >adding the next to it then write the byte or int to the file. My other Yeah, that's what I mentioned... >> Is this structure aligned (packed) correctly? >I looked up the structure from the wotsit web site. I've use information >from them before an I trust it as a good source of information >(http://www.wotsit.org/search.asp?s=graphics) Not at all what I was asking. "In Your Program" When It Is Compiled, Is The Structure Internally Aligned Correctly?? Is file_size Exactly 2 bytes into the structure, or is it 4bytes *When*Compiled*? >> Is file_size at bmp_file+2? >I'm not sure what you mean but the file size is suppose to be the complete Read my fingers. Is file_size AT (Located At) bmp_file+2? The third byte of the structure? With some compiler settings, it will be at the fith byte, which is wrong. >file size in bytes. However I've noticed that this is never the case with >any bitmap I've looked at. The bmp_file is supposed to be the size of the >bitmap data in bytes but agin, this is never the case. No, file_size is the size of the BMP in bytes, not the DATA. It is the File Size, not the Data Size. Hence the name. >> >bmp.file_size = 22326; >> >> Is that the correct file size? >> 640*480 alone is bigger than that. >Yes, I found this to be very interesting as well. If I create a 640x480x16 >bmp using M$ Paint the size is always 150K but the bmp.file_size is also >always 22326. I don't pretend to understand why this is but it is. Guessing it's because you were displaying it as a short int instead of the long it is. >> >bmp.bitmap_size = 22208; >> >> Is that the correct size? >> You are writting 640*480 bytes! >Yes, the function should capture the entire screen (640x480x16) but as I've >covered above bmp.bitmap_size does not seem to actually represent the size >correctly in any BMP I've looked at. So you just picked a number out of the air? amazing. >I suspect this is true as well. Do you recommend shifting the pixel data to >the left twice then add the next? Like this... >for (x = 0; x <= (bmp.width-1); x+=2) NOT equal, definately Not Equal ; x < (bmp.width-1); > { > pixel = getpixel(x,y) << 2; How many bits are you shifting there? How many bits are you working with? > pixel += getpixel(x,y); And what happens if there's something in the upper 4 bits of GetPixel? . 0