Beispiel #1
0
 public Reader(IBinaryStream file, LimMetaData info)
 {
     m_input  = file;
     m_width  = (int)info.Width;
     m_height = (int)info.Height;
     m_bpp    = info.BPP;
     m_flags  = info.Flags;
     if (32 == m_bpp)
     {
         Format = PixelFormats.Bgra32;
     }
     else if (16 == m_bpp)
     {
         Format = PixelFormats.Bgr565;
     }
     else
     {
         throw new InvalidFormatException();
     }
     m_image = new byte[m_width * m_height * m_bpp / 8];
 }
Beispiel #2
0
        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            if (0x4C != file.ReadByte() || 0x4D != file.ReadByte())
            {
                return(null);
            }
            int flag = file.ReadUInt16();

            if ((flag & 0xF) != 2 && (flag & 0xF) != 3)
            {
                return(null);
            }
            int bpp  = 0x10 == file.ReadUInt16() ? 16 : 32;
            var meta = new LimMetaData {
                BPP = bpp, Flags = flag
            };

            file.ReadUInt16();
            meta.Width  = file.ReadUInt32();
            meta.Height = file.ReadUInt32();
            return(meta);
        }