Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
unfortunately, there is a couple of shortcomings in my recently submitted
enhancements for storing RGB masks for 16 bit images in an MSDN compatible
First, according to MSDN, using BI_BITFIELDS and thus using RGB masks for 32
bit images is optional. If masks are not specified, that is, biCompression is
set to BI_RGB, Windows handles 32 bit images as everyone would expect
(including the usage of the alpha channel). Since FreeImage has no support for
32 bit bitmaps with a different layout (non of the toolkit function will
support such bitmaps), I decided to remove the RGB masks for 32 bit images.
Second, it is wrong to set member biClrUsed of type BITMAPINFOHEADER to 3 for
a bitmap with biCompression set to BI_BITFIELDS. Setting this member to a non-
zero positive value signals the presence of a so called optimal color table
(palette) with biClrUsed entries, following the 3 mask DWORDs. That color
table is used to optimize colors on palette-based devices. Actually, setting
biClrUsed to 3 without having that optimal color table leads to corrupt BMP
files, that may crash or hang other applications (like IrfanView, for
Additionally, doing so returns 3 from function FreeImage_GetColorsUsed (which
is wrong) and also any function that depends on FreeImage_GetColorsUser
returning zero for non palletized images, like FreeImage_GetDIBSize (actually
we should think about including these 12 bytes into what FreeImage_GetDIBSize
returns, since the RGB masks are actually part of the DIB size.).
The reason why I set biClrUsed to 3 is obvious; it is a nice (but wrong) way
to jump over these 12 additional bytes in function FreeImage_GetBits.
So, now, there is a new line in FreeImage_GetBits, that adds sizeof(DWORD) * 3
to the pointer, if the newly introduced public (exported) function
FreeImage_HasRGBMasks returns TRUE (of course, the same could be done for
FreeImage_GetDIBSize, if you think we should include the masks into the size).
I'll send you a mail with the source files needing updates attached.
Thanks for the patch, it is now available in the CVS.
However, I put the FreeImage_HasRGBMasks function declaration into
"Utilities.h" instead of make it public. I don't think it can be useful to FI
users, unless you tell me it is.
no, actually there is no need to make this function public. However, the
comment on the function's declaration in Utilities.h is actually wrong. It is
the comment of function FreeImage_GetRGBMasks...