Jump to content
  • Advertisement
Sign in to follow this  
kayX

Bitmap storage

This topic is 4623 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
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
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!