Pixel Format Encoding

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Pixel Format Encoding

Post by PearOs »

Hey guys, this is probably a simple question but what is the pixel encoding for 16bpp? I looked it up and found: http://en.wikipedia.org/wiki/BMP_file_format but the 16bpp encoding doesn't seem to work right with my 16bpp VBE mode. So what is the correct encoding? And how would you go about converting a regular RGB value as three bytes into a 16bpp word?

Thanks, Matt
Octocontrabass
Member
Member
Posts: 6301
Joined: Mon Mar 25, 2013 7:01 pm

Re: Pixel Format Encoding

Post by Octocontrabass »

Don't assume pixel formats.

The typical conversion from a higher depth to 16bpp to is to remove the lowest few bits of each channel and shift them into the correct locations. The VBE functions will tell you how many bits to remove and how far to shift.

(You probably won't see too much variety in real video cards, though: most will be kind of like this.)
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: Pixel Format Encoding

Post by PearOs »

Octocontrabass wrote:Don't assume pixel formats.

The typical conversion from a higher depth to 16bpp to is to remove the lowest few bits of each channel and shift them into the correct locations. The VBE functions will tell you how many bits to remove and how far to shift.

(You probably won't see too much variety in real video cards, though: most will be kind of like this.)
Ok thanks Octocontrabass!

- Matt
Post Reply