Esempio n. 1
0
        public override IImageDecoder OpenImage(ArcFile arc, Entry entry)
        {
            int type = arc.File.View.ReadByte(entry.Offset + 8);

            if (type > 1)
            {
                return(base.OpenImage(arc, entry));
            }
            var  pent   = entry as PackedEntry;
            bool packed = pent != null && pent.IsPacked;
            var  info   = new CgMetaData {
                Width      = arc.File.View.ReadUInt32(entry.Offset),
                Height     = arc.File.View.ReadUInt32(entry.Offset + 4),
                BPP        = packed ? 16 : 8,
                HasPalette = type == 1,
            };
            var cg_arc = arc as CgArchive;

            if (cg_arc != null)
            {
                info.DefaultPalette = cg_arc.DefaultPalette;
            }
            var input = arc.File.CreateStream(entry.Offset, entry.Size);

            if (packed)
            {
                return(new UCgDecoder(input, info));
            }
            else
            {
                return(new CgDecoder(input, info));
            }
        }
Esempio n. 2
0
 public UCgDecoder(IBinaryStream input, CgMetaData info) : base(input, info)
 {
 }
Esempio n. 3
0
 public CgDecoder(IBinaryStream input, CgMetaData info) : base(input, info)
 {
     m_has_palette = info.HasPalette;
     m_palette     = info.DefaultPalette;
 }