(DwqFormat): refined alpha-channel detection.

This commit is contained in:
morkt 2016-05-20 04:10:12 +04:00
parent d2ff05fd8f
commit f4517d4183

View File

@ -2,7 +2,7 @@
//! \date Sat Aug 01 13:18:46 2015
//! \brief Black Cyc image format.
//
// Copyright (C) 2015 by morkt
// Copyright (C) 2015-2016 by morkt
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
@ -66,7 +66,7 @@ namespace GameRes.Formats.BlackCyc
public string BaseType;
public int PackedSize;
public int PackType;
public bool AType;
public bool HasAlpha;
}
[Export(typeof(ImageFormat))]
@ -112,7 +112,7 @@ namespace GameRes.Formats.BlackCyc
BaseType = "BMP",
PackedSize = (int)(stream.Length-0x40),
PackType = header.PackType,
AType = header.AType,
HasAlpha = header.AType,
};
}
}
@ -142,7 +142,7 @@ namespace GameRes.Formats.BlackCyc
BaseType = Encoding.ASCII.GetString (header.Bytes, 0, 0x10).TrimEnd(),
PackedSize = packed_size,
PackType = header.PackType,
AType = header.AType,
HasAlpha = header.AType || 7 == header.PackType,
};
}
@ -186,7 +186,7 @@ namespace GameRes.Formats.BlackCyc
}
if (null == bitmap)
throw new NotImplementedException();
if (meta.AType)
if (meta.HasAlpha)
{
int mask_offset = 0x40+meta.PackedSize;
if (mask_offset != stream.Length)