From af600a78dc0f71100432cbb39792b308199fde9b Mon Sep 17 00:00:00 2001 From: giraffedata Date: Fri, 12 Oct 2007 16:27:11 +0000 Subject: add comments git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@436 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/bmptopnm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'converter') diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c index dd7be892..aaaf59c1 100644 --- a/converter/other/bmptopnm.c +++ b/converter/other/bmptopnm.c @@ -17,6 +17,11 @@ in supporting documentation. This software is provided "as is" without express or implied warranty. + Note: From mid-2003 to mid-2007, this program would crash on any 16 + bit BMP without transparency and no one reported it. Before that, it + refused to even try to read a 16 bit BMP. I conclude that esentially + nobody is using 16 bit BMP. + *****************************************************************************/ #include #include @@ -479,6 +484,10 @@ defaultPixelformat(unsigned int const bitCount) { switch (bitCount) { case 16: + /* This layout is sometimes called "RGB555". A document from + Microsoft says this is the default (when the "compression" + field of the header says COMP_BITFIELDS). + */ retval.conventionalBgr = FALSE; retval.red.shift = 10; retval.grn.shift = 5; @@ -516,6 +525,11 @@ readV4InfoHeaderExtension(FILE * const ifP, struct bmpInfoHeader * const headerP) { if (headerP->bitFields) { + /* A document from Microsoft says on Windows 95 there is no + transparency plane and (red, green, blue) must be either + (5,5,5) or (5,6,5) for 16 bit and (8,8,8) for 32 bit. + It calls these RGB555, RGB565, RGB888. + */ headerP->pixelformat.red = bitPositionFromMask(GetLong(ifP)); headerP->pixelformat.grn = bitPositionFromMask(GetLong(ifP)); headerP->pixelformat.blu = bitPositionFromMask(GetLong(ifP)); -- cgit 1.4.1