   bitmap file format (solved)
  i've written a bitmap file loader when i display the buffered data it seems inverted. my test file had a black left-top-corner and white bottom-right-corner, and when displayed both of these are switched roundwhen you get to the image data in the bitmap file which way is this stored? is it column-by-column, row-by-row etc?im transferring all the data to a 2d array of a struct "colour" containg the rgb values so it's array[width][height]here's some code that might not be relevant but just in case it is:before this code the stream of bytes are converted to an array of integers of length width*height*3this is then converted to the array of colour structs clamped between 0 and 1. again this may not be at all useful so you can probably ignore it. the bit in the rgbintegers index is how i test the relevant cell in the first stream. pixel is the new 2d arrayfor(i=0;i<width;i++)for (int j=0;j<height;j++){if(rgbintegers[(((height*3)*i)+(j*3))]!=0)//this prevents divide-by-zero errorspixel[j].r=255/(float)rgbintegers[(((height*3)*i)+(j*3))];elsepixel[j].r=rgbintegers[(((height*3)*i)+(j*3))];if(rgbintegers[(((height*3)*i)+(j*3))+1]!=0)pixel[j].g=255/(float)rgbintegers[(((height*3)*i)+(j*3))+1];elsepixel[j].g=rgbintegers[(((height*3)*i)+(j*3))+1];if(rgbintegers[(((height*3)*i)+(j*3))+2]!=0)pixel[j].b=255/(float)rgbintegers[(((height*3)*i)+(j*3))+2];elsepixel[j].b=rgbintegers[(((height*3)*i)+(j*3))+2];[Edited by - Mantrid on December 7, 2005 2:48:49 PM]
  In a prior thread that I cannot find, a user explained why bitmap were "verticaly inverted".The reason was that in that time, the bitmap was to be as closely mapped to the hardware (ie :  videocard memory/screen).  This way, the memory block of the bitmap could be copied "as is" in the video memory.because the location 0,0 in a monitor is top-left ... and the location 0,0 in a normal image is bottom-left, the image had to be vertically inverted in order to be directly copied into video memory.   ;  hm. when i switched around the co-ordinates for each pixel (so i plotted the width as height and height as width) it solved it :(it'll display images saved in paintok, but anything converted from jpg (for example) to 24-bit bitmap gives a value higher than 255 when it's put through that conversion so most of it is showing up as superwhite.surely 255 is the highest colour value that each byte can store?btw cheers man, ratededit:*Mantrid puts the 255 UNDER the division, gets his coat and leaves quietly[Edited by - Mantrid on December 7, 2005 2:30:40 PM]