Sign in to follow this  
kayX

Bitmap storage

Recommended Posts

kayX    152
Hi, Anyone knows why a bitmap is stored vertically fliped? What is the reason or advantage for doing so? Thanks in advance

Share this post


Link to post
Share on other sites
PixelPhil    218
Hi,

The beam of a CRT monitor scans the screen surface from the left to ther right and from the top to the bottom. So historically the most natural memory layout for storing images is from the top left to the bottom right pixel.
A fullscreen image stored this way could be symply copied to the video memory in one memcpy (or DMA copy) and the RAMDAC would display it correctly.

Phil

Share this post


Link to post
Share on other sites
TDragon    679
PixelPhil: But the bitmaps that kayX is referring to are stored from the bottom row to the top row.

kayX: I don't know the answer offhand, but a quick search of Wikipedia would probably turn something up.

Share this post


Link to post
Share on other sites
eq    654
If you're drawing diagram you normally have the X axis going from negative to positive from left to right.
The Y axis is going from negative to positive from bottom to up.

I think that the bmp format was invented eons ago by academics that thought that this was the logical thing to do.

"Modern" formats such as (.png, .dds, .jpg, .tif) store all bitmaps top-down.
.tga's can be stored in both ways as can .bmp's (I think that if the horizontal size is negative it's stored top-down, a bit unsure though).



Share this post


Link to post
Share on other sites
Kippesoep    892
Quote:
Original post by eq
(I think that if the horizontal size is negative it's stored top-down, a bit unsure though).


That would be the vertical. Makes sense, too.

Share this post


Link to post
Share on other sites
don    431
In the case of Windows DIB format, a negative biHeight value signifies a top-down orientation, while a positive biHeight value refers to a bottom-up orientation.

This bottom-up format is a holdover from OS/2 Presentation Manager where location (0, 0) was at the bottom left corner of the screen.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this