Hi Guy,

On 1/12/10 3:58 , Guy Volckaert wrote:
> I noticed that the alpha component in the BMP file (when RGBA or BGRA) is not 
> being
> preserved in the image. I would like to proposed the following small change 
> to correct
> this problem. Instead of ignoring the alpha component, I first check if the 
> bytesPerPixel
> == 4 bytes. If so, then I simply copy the row alpha to the image alpha 
> component.
> 
> Does that make sense? Or am I not following the BMP standard?

The bmp reader is only evaluating the V3 header that doesn't specify alpha, so 
it's always
possible for something to break.  However, this looks like it should still be 
okay.

I tested my bmp patches against the files from
http://wvnvaxa.wvnet.edu/vmswww/bmp.html (the compressed ones don't work IIRC).

Cheers,
/ulrich

> Code:
> 
>...
>                     if (imageBytesPerPixel == 4)
>                     {
>                         // ********* THIS IS MY CHANGE*******
>                         if( bytesPerPixel == 4 )
>                         {
>                             imgp[3] = rowp[3];
>                         }
>                         else
>                         {
>                             imgp[3] = 0xFF;
>                         }
>                     }
>                 }
>                 imgp += imageBytesPerPixel;
>                 rowp += bytesPerPixel;
>             }
>         }
>     }
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to