From db43e34bce2d19099c1f5b9dcd9ac1c2039d4033 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 28 Jun 2004 13:18:10 +0000 Subject: [PATCH] From Michael Gronager, added support for alpha channel in writing of BMP images --- src/osgPlugins/bmp/ReaderWriterBMP.cpp | 45 +++++++++++++++++++------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/src/osgPlugins/bmp/ReaderWriterBMP.cpp b/src/osgPlugins/bmp/ReaderWriterBMP.cpp index 5d6f677e0..3a1585516 100644 --- a/src/osgPlugins/bmp/ReaderWriterBMP.cpp +++ b/src/osgPlugins/bmp/ReaderWriterBMP.cpp @@ -228,7 +228,7 @@ int *numComponents_ret) ncomp = BW; // actually this is a 256 colour, paletted image inf.Colorbits=8; // so this is how many bits there are per index //inf.ColorUsed=256; // and number of colours used - if(!inf.ColorUsed) inf.ColorUsed=256; /*the bitmap has 256 colours if ColorUsed = 0 otherwise as many as stored in ColorUsed*/ + if(!inf.ColorUsed) inf.ColorUsed=256; /*the bitmap has 256 colours if ColorUsed = 0 otherwise as many as stored in ColorUsed*/ cols=imbuff; // colour palette address - uses 4 bytes/colour break; case 2: @@ -402,7 +402,7 @@ class ReaderWriterBMP : public osgDB::ReaderWriter inf.YpixPerMeter=1000; //pixels per meter in Y inf.ColorUsed=0; //number of colors used inf.Important=0; //number of "important" colors - // inf.os2stuff[6]; // allows os2.1 with 64 bytes to be read. Dont know what these are yet. + // inf.os2stuff[6]; // allows os2.1 with 64 bytes to be read. Dont know what these are yet. infsize=sizeof(BMPInfo)+sizeof(long); fwrite(&infsize, sizeof(long), 1, fp); fwrite(&inf, sizeof(inf), 1, fp); // one dword shorter than the structure defined by MS @@ -411,17 +411,40 @@ class ReaderWriterBMP : public osgDB::ReaderWriter osg::notify(osg::INFO) << "sizes "<