示例#1
0
文件: ImageS25.cs 项目: zxc120/GARbro
        }                                                                 // 'S25'

        // in current implementation, only the first frame is returned.
        // per-frame access is provided by S25Opener class.

        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            file.Position = 4;
            int count = file.ReadInt32();

            if (count < 0 || count > 0xfffff)
            {
                return(null);
            }
            uint first_offset = 0;

            for (int i = 0; i < count && 0 == first_offset; ++i)
            {
                first_offset = file.ReadUInt32();
            }
            if (0 == first_offset)
            {
                return(null);
            }
            file.Position = first_offset;
            var info = new S25MetaData();

            info.Width       = file.ReadUInt32();
            info.Height      = file.ReadUInt32();
            info.OffsetX     = file.ReadInt32();
            info.OffsetY     = file.ReadInt32();
            info.FirstOffset = first_offset + 0x14;
            info.Incremental = 0 != (file.ReadUInt32() & 0x80000000u);
            info.BPP         = 32;
            return(info);
        }
示例#2
0
        }                                                                 // 'S25'

        // in current implementation, only the first frame is returned.
        // per-frame access is provided by S25Opener class.

        public override ImageMetaData ReadMetaData(Stream stream)
        {
            using (var input = new ArcView.Reader(stream))
            {
                input.ReadUInt32();
                int count = input.ReadInt32();
                if (count < 0 || count > 0xfffff)
                {
                    return(null);
                }
                uint first_offset = input.ReadUInt32();
                if (0 == first_offset)
                {
                    return(null);
                }
                input.BaseStream.Position = first_offset;
                var info = new S25MetaData();
                info.Width       = input.ReadUInt32();
                info.Height      = input.ReadUInt32();
                info.OffsetX     = input.ReadInt32();
                info.OffsetY     = input.ReadInt32();
                info.FirstOffset = first_offset + 0x14;
                info.Incremental = 0 != (input.ReadUInt32() & 0x80000000u);
                info.BPP         = 32;
                return(info);
            }
        }
示例#3
0
 public Reader(Stream file, S25MetaData info)
 {
     m_width       = (int)info.Width;
     m_height      = (int)info.Height;
     m_output      = new byte[m_width * m_height * 4];
     m_input       = new ArcView.Reader(file);
     m_origin      = info.FirstOffset;
     m_incremental = info.Incremental;
 }
示例#4
0
文件: ImageS25.cs 项目: zxc120/GARbro
 public Reader(IBinaryStream file, S25MetaData info, bool leave_open = false)
 {
     m_width          = (int)info.Width;
     m_height         = (int)info.Height;
     m_output         = new byte[m_width * m_height * 4];
     m_input          = file;
     m_origin         = info.FirstOffset;
     m_incremental    = info.Incremental;
     m_info           = info;
     m_should_dispose = !leave_open;
 }
示例#5
0
        public override IImageDecoder OpenImage(ArcFile arc, Entry entry)
        {
            var offset = entry.Offset;
            var info   = new S25MetaData
            {
                Width       = arc.File.View.ReadUInt32(offset),
                Height      = arc.File.View.ReadUInt32(offset + 4),
                OffsetX     = arc.File.View.ReadInt32(offset + 8),
                OffsetY     = arc.File.View.ReadInt32(offset + 12),
                BPP         = 32,
                FirstOffset = (uint)(offset + 0x14),
                Incremental = 0 != (arc.File.View.ReadUInt32(offset + 0x10) & 0x80000000u),
            };
            var input = arc.File.CreateStream(0, (uint)arc.File.MaxOffset);

            return(new S25Format.Reader(input, info));
        }
示例#6
0
        public override Stream OpenEntry(ArcFile arc, Entry entry)
        {
            // emulate TGA image
            var offset = entry.Offset;
            var info   = new S25MetaData
            {
                Width       = arc.File.View.ReadUInt32(offset),
                Height      = arc.File.View.ReadUInt32(offset + 4),
                OffsetX     = arc.File.View.ReadInt32(offset + 8),
                OffsetY     = arc.File.View.ReadInt32(offset + 12),
                BPP         = 32,
                FirstOffset = (uint)(offset + 0x14),
                Incremental = 0 != (arc.File.View.ReadUInt32(offset + 0x10) & 0x80000000u),
            };

            using (var input = arc.File.CreateStream(0, (uint)arc.File.MaxOffset))
                using (var reader = new S25Format.Reader(input, info))
                {
                    return(TgaStream.Create(info, reader.Unpack()));
                }
        }
示例#7
0
文件: ImageS25.cs 项目: Casidi/GARbro
 // in current implementation, only the first frame is returned.
 // per-frame access is provided by S25Opener class.
 public override ImageMetaData ReadMetaData(Stream stream)
 {
     using (var input = new ArcView.Reader (stream))
     {
         input.ReadUInt32();
         int count = input.ReadInt32();
         if (count < 0 || count > 0xfffff)
             return null;
         uint first_offset = input.ReadUInt32();
         if (0 == first_offset)
             return null;
         input.BaseStream.Position = first_offset;
         var info = new S25MetaData();
         info.Width = input.ReadUInt32();
         info.Height = input.ReadUInt32();
         info.OffsetX = input.ReadInt32();
         info.OffsetY = input.ReadInt32();
         info.FirstOffset = first_offset+0x14;
         info.Incremental = 0 != (input.ReadUInt32() & 0x80000000u);
         info.BPP = 32;
         return info;
     }
 }
示例#8
0
文件: ImageS25.cs 项目: Casidi/GARbro
 public Reader(Stream file, S25MetaData info)
 {
     m_width = (int)info.Width;
     m_height = (int)info.Height;
     m_output = new byte[m_width * m_height * 4];
     m_input = new ArcView.Reader (file);
     m_origin = info.FirstOffset;
     m_incremental = info.Incremental;
 }
示例#9
0
文件: ArcS25.cs 项目: Casidi/GARbro
 public override Stream OpenEntry(ArcFile arc, Entry entry)
 {
     // emulate TGA image
     var offset = entry.Offset;
     var info = new S25MetaData
     {
         Width   = arc.File.View.ReadUInt32 (offset),
         Height  = arc.File.View.ReadUInt32 (offset+4),
         OffsetX = arc.File.View.ReadInt32 (offset+8),
         OffsetY = arc.File.View.ReadInt32 (offset+12),
         BPP     = 32,
         FirstOffset = (uint)(offset + 0x14),
         Incremental = 0 != (arc.File.View.ReadUInt32 (offset+0x10) & 0x80000000u),
     };
     using (var input = arc.File.CreateStream (0, (uint)arc.File.MaxOffset))
     using (var reader = new S25Format.Reader (input, info))
     {
         return TgaStream.Create (info, reader.Unpack());
     }
 }