(TgaFormat): read grayscale images.

This commit is contained in:
morkt 2015-12-09 17:57:48 +04:00
parent 17e9273e3e
commit 1c457e1249

View File

@ -195,7 +195,12 @@ namespace GameRes
switch (meta.BPP) switch (meta.BPP)
{ {
default: throw new InvalidFormatException(); default: throw new InvalidFormatException();
case 8: Format = PixelFormats.Indexed8; break; case 8:
if (1 == meta.ColormapType)
Format = PixelFormats.Indexed8;
else
Format = PixelFormats.Gray8;
break;
case 15: Format = PixelFormats.Bgr555; break; case 15: Format = PixelFormats.Bgr555; break;
case 16: Format = PixelFormats.Bgr555; break; case 16: Format = PixelFormats.Bgr555; break;
case 32: Format = PixelFormats.Bgra32; break; case 32: Format = PixelFormats.Bgra32; break;
@ -244,9 +249,7 @@ namespace GameRes
{ {
switch (m_meta.ImageType) switch (m_meta.ImageType)
{ {
case 3: // Uncompressed, black and white images.
case 9: // Runlength encoded color-mapped images. case 9: // Runlength encoded color-mapped images.
case 11: // Compressed, black and white images.
case 32: // Compressed color-mapped data, using Huffman, Delta, and case 32: // Compressed color-mapped data, using Huffman, Delta, and
// runlength encoding. // runlength encoding.
case 33: // Compressed color-mapped data, using Huffman, Delta, and case 33: // Compressed color-mapped data, using Huffman, Delta, and
@ -256,9 +259,11 @@ namespace GameRes
throw new InvalidFormatException(); throw new InvalidFormatException();
case 1: // Uncompressed, color-mapped images. case 1: // Uncompressed, color-mapped images.
case 2: // Uncompressed, RGB images. case 2: // Uncompressed, RGB images.
case 3: // Uncompressed, black and white images.
ReadRaw(); ReadRaw();
break; break;
case 10: // Runlength encoded RGB images. case 10: // Runlength encoded RGB images.
case 11: // Compressed, black and white images.
ReadRLE ((m_meta.BPP+7)/8); ReadRLE ((m_meta.BPP+7)/8);
break; break;
} }