Subj : Re: BITMAPINFO To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Wed Aug 06 2003 07:44 am Tristan Szaniawski wrote: >In Win3.1 SDK, in the description of BITMAPINFO structure it is said: >"The bits in the array are packed together, but each scan line >must be zero-padded to end on a LONG boundary. Segment boundaries, > however, can appear anywhere in the bitmap." It`s about DIB array bits. >What does 'zero-padded to end on a LONG boundary' mean ? If you have 4 bits per pixel, then each hex digit below is one pixel (8 in this example). unsigned char array[] = { 0x21, 0x43, 0x65, 0x87 }; Note that this is also the size of a long (4 bytes). > zero-padded to end on a LONG boundary means if you only had, say 3 pixels it would be unsigned char array[] = { 0x21, 0x03, 0x00, 0x00 }; The remaing pixels are set to zero, and there are an even number of LONGs in the arrar (the array is evenly divisible by 4 bytes). If you had 3 bits per pixel, you'd get more pixels per long (and they would overflow to the next long), but you still need an even number of 4 bytes. >Segment boundaries, however, can appear anywhere in the bitmap." Means you can ignore segment issues within a BMP. That is, BMPs can span segments. >SetDIBitsToDevice does not display 258x265x8bit bitmap, but displays >204x293x24bit bitmap. 0xFFFF / 258 = 254 + 4 so the line begins in one segment and ends >in another, but 0xFFFF / (204*3) = 107 + 52 so this line also starts in one segment and >ends in another. So why 24bit bitmap is displayed and 8bit isn`t ? >I work under win16bit Don't know. Is the 8bit an ok BMP? Can you view it in Paint? Maybe something wrong in your call to SetDIBitsToDevice? If you still can't get it to work, post your code (please use cut-n-paste) where you setup for and call the display, both for the one that works and the one that doesn't, we might be able to see where you went wrong. If it's not the code, then it would be the BMP. .