The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: z9999 on September 14, 2008, 12:56:45 am

Title: r2020 - BMP height map rotates 180 degree
Post by: z9999 on September 14, 2008, 12:56:45 am
simutrans 2020 GDI

When I load bmp height map, the image rotates 180 degree.
And superfluity pixel causes misalignment of image.

I think bmp stores last pixel first.
Title: Re: r2020 - BMP height map rotates 180 degree
Post by: VS on September 14, 2008, 07:25:00 am
Yes, bmp is written backwards, at least the 24bpp colour variant (open some on the web and see for yourself). But not really backwards, only lines are from bottom to top, pixels within lines are left to right:

Quote
The bitmap bits, immediately following the color table, consist of an array of BYTE values representing consecutive rows, or "scan lines," of the bitmap. Each scan line consists of consecutive bytes representing the pixels in the scan line, in left-to-right order. The number of bytes representing a scan line depends on the color format and the width, in pixels, of the bitmap. If necessary, a scan line must be zero-padded to end on a 32-bit boundary. However, segment boundaries can appear anywhere in the bitmap. The scan lines in the bitmap are stored from bottom up. This means that the first byte in the array represents the pixels in the lower-left corner of the bitmap and the last byte represents the pixels in the upper-right corner.
Title: Re: r2020 - BMP height map rotates 180 degree
Post by: prissi on September 14, 2008, 10:08:17 am
Well, height can be negative, and in this case the bitmap is the other way round. Which bitmap is off? Usually padding in 24Bit is strange. (Actually, I have well working routines at university, but the backup is not working for some days, so I had the write them frommemory and Wikipedia docu.) Will look at it.
Title: [solved]Re: r2020 - BMP height map rotates 180 degree
Post by: z9999 on September 15, 2008, 04:46:06 am
solved in r2022. Thank you.