1
0

CImageLoaderBMP now supports loading 1-bit images with palette data

The feature everyone has been waiting for!!! Or not...
Anyway it works now :-)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6600 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2024-03-13 19:30:48 +00:00
parent b17fe835bc
commit 8f8a4ef5e1
4 changed files with 19 additions and 5 deletions

View File

@@ -414,7 +414,20 @@ IImage* CImageLoaderBMP::loadImage(io::IReadFile* file) const
case 1:
image = new CImage(ECF_A1R5G5B5, dim);
if (image)
CColorConverter::convert1BitTo16Bit(bmpData, (s16*)image->getData(), header.Width, header.Height, pitch, true);
{
s16 colors[2] = {(s16)0x8000, (s16)0xffff }; // off: only alpha set, on: all white
if ( paletteSize == 1 )
{
u8 in = 0;
CColorConverter::convert8BitTo16Bit(&in, colors, 1, 1, paletteData);
}
else if ( paletteSize >= 2 )
{
u8 in[2] = { 0, 1 };
CColorConverter::convert8BitTo16Bit(in, colors, 2, 1, paletteData);
}
CColorConverter::convert1BitTo16Bit(bmpData, (s16*)image->getData(), header.Width, header.Height, pitch, true, colors[0], colors[1]);
}
break;
case 4:
image = new CImage(ECF_A1R5G5B5, dim);