News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

BI_BITFIELDS

Started by oex, March 24, 2011, 05:53:10 AM

Previous topic - Next topic

oex

Is BI_BITFIELDS just RGB(A) in a different order or do I need to rewrite my Bitmap code :/....

White is coming out purple whether I switch G&B or not....

These are the first 3 (palette?) colors
16711680
65280
255

It's a lot of code to sort out and rewrite without my macros but I think what I've given will make sense to someone who had dealt with BI_BITFIELDS.... I know that it can have different bit resolutions for different colors but this is data from the clipboard....

As I understand it from the data I have the first 3 data colors are palette colors RGB and then a normal BI_RGB follows (but based on these colors)....

Some infos are here: http://en.wikipedia.org/wiki/BMP_file_format

So long as I can validate the format I have and retrieve data from it I dont really care about other formats/possibilities for now....


19778
0
0
0
0

BITMAPINFOHEADER
40
1280
1024
1
32                    <---- 32 Bit
3                     <---- BI_BITFIELDS
5242880
0
0
0
0
16711680              <---- First 3
65280
255
1655205               <---- First Pixel
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

donkey

No, BI_RGB uses 555 encoding while BI_BITFIELDS uses 565 encoding in 16 bit color.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

oex

This is 32 bit


BITMAPINFOHEADER
40
1280
1024
1
32                    <---- 32 Bit
3                     <---- BI_BITFIELDS
5242880
0
0
0
0
16711680              <---- First 3             00FF0000h
65280                                           0000FF00h
255                                             000000FFh
1655205               <---- First Pixel


I think the last 4 DWORDs are represented right.... The first 3 *I think* represent RGB.... Then it carries on and represents the data....

Maybe a more precise link?

Is this an Endian Issue????

FF0000 B
00FF00 G
0000FF R
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

donkey

Well, BI_BITFIELDS is generally used for 16 bit, however for 32 bit it is not always RGB(A) or (A)BGR. The position of the colors and alpha channel in a BI_BITFIELDS image in 32 bit depend on the masks. You use a BITMAPV5HEADER and set the bV5RedMask, bV5GreenMask, bV5BlueMask and bV5AlphaMask to assign the bits to the appropriate colors, using a regular header the palette is used to store the masks. For example using BI_BITFIELDS on a 32 bpp image you can have RABG if you like, its up to the programmer to set the order of the colors, you can even interleave them if you want.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

oex

Oh I get it nice 1 ty!
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv