Exemple #1
0
        public override ImageMetaData ReadMetaData(IBinaryStream stream)
        {
            var  header = stream.ReadHeader(0x11);
            byte type   = header[0];

            if (type != 0 && type != 1)
            {
                return(null);
            }
            var info = new GecMetaData
            {
                Type        = type,
                OffsetX     = header.ToInt16(1),
                OffsetY     = header.ToInt16(3),
                Width       = header.ToUInt16(5),
                Height      = header.ToUInt16(7),
                BPP         = 0 == type ? 24 : 32,
                AlphaOffset = header.ToInt32(9),
                DataOffset  = header.ToInt32(0xD),
            };

            if (info.OffsetX < 0 || info.OffsetY < 0 || info.Width <= 0 || info.Height <= 0 ||
                info.DataOffset < 0 || info.DataOffset > stream.Length)
            {
                return(null);
            }
            if (1 == type && info.AlphaOffset <= 0)
            {
                return(null);
            }
            return(info);
        }
Exemple #2
0
 public GecReader(Stream input, GecMetaData info)
 {
     m_input = new byte[input.Length];
     input.Read(m_input, 0, m_input.Length);
     m_info = info;
 }