public BcfReader(IBinaryStream input, BcfMetaData info) { m_input = input; m_info = info; if (24 == m_info.BPP) { Format = PixelFormats.Bgr24; Stride = m_info.Stride; } else { Format = PixelFormats.Bgra32; Stride = 4 * (int)m_info.Width; } m_output = new byte[m_info.Stride * (int)info.Height]; }
} // 'BCF' public override ImageMetaData ReadMetaData(IBinaryStream file) { var header = file.ReadHeader(0x20); var info = new BcfMetaData { Width = header.ToUInt16(4), Height = header.ToUInt16(6), Stride = header.ToInt32(8), DataShift = header[0xC], AlphaShift = header[0xD], DataOffset = header.ToUInt32(0x10), DataBitsOffset = header.ToUInt32(0x14), AlphaOffset = header.ToUInt32(0x18), AlphaBitsOffset = header.ToUInt32(0x1C), }; info.BPP = 0 == info.AlphaOffset ? 24 : 32; return(info); }