Пример #1
0
        public override IImageDecoder OpenImage(ArcFile arc, Entry entry)
        {
            OrgMetaData info;

            if (VFS.IsPathEqualsToFileName(arc.File.Name, "MASK.DAT"))
            {
                info = new OrgMetaData {
                    Width  = arc.File.View.ReadUInt32(entry.Offset),
                    Height = arc.File.View.ReadUInt32(entry.Offset + 4),
                    BPP    = 8,
                    IsMask = true,
                };
            }
            else
            {
                byte has_alpha = arc.File.View.ReadByte(entry.Offset);
                byte type      = arc.File.View.ReadByte(entry.Offset + 1);
                if (has_alpha > 1 || type < 1 || type > 3)
                {
                    return(base.OpenImage(arc, entry));
                }
                info = new OrgMetaData {
                    Width    = arc.File.View.ReadUInt16(entry.Offset + 2),
                    Height   = arc.File.View.ReadUInt16(entry.Offset + 4),
                    HasAlpha = has_alpha != 0,
                    Method   = type,
                    BPP      = 32,
                };
            }
            var input = arc.File.CreateStream(entry.Offset, entry.Size);

            return(new OrgImageDecoder(input, info));
        }
Пример #2
0
 public OrgImageDecoder(IBinaryStream input, OrgMetaData info) : base(input, info)
 {
     m_info   = info;
     m_width  = (int)info.Width;
     m_height = (int)info.Height;
 }