Exemple #1
0
        public override IImageDecoder OpenImage(ArcFile arc, Entry entry)
        {
            var input = arc.OpenBinaryEntry(entry);
            int fmt   = (int)input.Signature & 0xFFFF;

            if (fmt > 4)
            {
                return(ImageFormatDecoder.Create(input));
            }
            var header = input.ReadHeader(14);

            input.Position = 0;
            int hpos = 2;

            if (1 == fmt || 3 == fmt)
            {
                hpos = 8;
            }
            int cmp = header.ToUInt16(hpos);
            int bpp = 0;

            switch (cmp & 0xFF)
            {
            case 2: bpp = 4; break;

            case 3: bpp = 8; break;

            case 5: bpp = 24; break;

            default:
                return(ImageFormatDecoder.Create(input));
            }
            var info = new LcImageMetaData {
                Width       = header.ToUInt16(hpos + 2),
                Height      = header.ToUInt16(hpos + 4),
                BPP         = bpp,
                Format      = fmt,
                Compression = cmp,
                DataOffset  = hpos + 6,
            };

            return(new LcImageDecoder(input, info));
        }
Exemple #2
0
 public LcImageDecoder(IBinaryStream input, LcImageMetaData info) : base(input, info)
 {
     m_info = info;
 }