News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

r2020 - BMP height map rotates 180 degree

Started by z9999, September 14, 2008, 12:56:45 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

z9999

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.

VS

#1
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.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

prissi

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.

z9999