public override IImageDecoder OpenImage(ArcFile arc, Entry entry) { if (entry.Size < 0x36 || !arc.File.View.AsciiEqual(entry.Offset, "BM")) { return(base.OpenImage(arc, entry)); } uint header_size = arc.File.View.ReadUInt32(entry.Offset + 0xA); if (header_size < 0x36 || header_size > entry.Size) { return(base.OpenImage(arc, entry)); } int height = arc.File.View.ReadInt32(entry.Offset + 0x16); var info = new BmMetaData { Width = arc.File.View.ReadUInt32(entry.Offset + 0x12), Height = (uint)Math.Abs(height), BPP = arc.File.View.ReadUInt16(entry.Offset + 0x1C), DataOffset = header_size, IsFlipped = height > 0, IsCompressed = arc.File.View.ReadUInt32(0x32) != 0, }; var input = arc.File.CreateStream(entry.Offset, entry.Size); return(new BmpDecoder(input, info)); }
public BmpDecoder(IBinaryStream input, BmMetaData info) : base(input, info) { }