public SpReader(IBinaryStream input, SpMetaData info) { m_input = input; m_info = info; m_output = new byte[info.Width * info.Height]; m_stride = (int)info.Width; }
public override ImageMetaData ReadMetaData(IBinaryStream file) { var header = file.ReadHeader(0x22); if (header.ToInt32(4) != 0) { return(null); } int flags = header.ToUInt16(0); if ((flags & ~0xFF) != 0 || header[2] != 1) { return(null); } var info = new SpMetaData { Width = header.ToUInt16(0x16), Height = header.ToUInt16(0x18), BPP = 8, Flags = flags, Colors = header.ToUInt16(0x1E), }; if (info.Width == 0 || info.Width > 0x2000 || info.Height == 0 || info.Height > 0x2000 || info.Colors > 0x100) { return(null); } if (info.IsEncrypted) { if (null == DefaultKey) { DefaultKey = QueryKey(file.Name); if (null == DefaultKey) { return(null); } } info.Key = DefaultKey; } return(info); }