Beispiel #1
0
 protected HgReader(Stream input, HgMetaData info)
 {
     m_input      = new ArcView.Reader(input);
     m_info       = info;
     m_pixel_size = m_info.BPP / 8;
     Stride       = (int)m_info.Width * m_pixel_size;
 }
Beispiel #2
0
 protected HgReader(IBinaryStream input, HgMetaData info)
 {
     m_input      = input;
     m_info       = info;
     m_pixel_size = m_info.BPP / 8;
     Stride       = (int)m_info.Width * m_pixel_size;
 }
Beispiel #3
0
        public override IImageDecoder OpenImage(ArcFile arc, Entry entry)
        {
            var offset = entry.Offset + 8;
            var info   = new HgMetaData
            {
                HeaderSize   = arc.File.View.ReadUInt32(offset),
                Width        = arc.File.View.ReadUInt32(offset + 8),
                Height       = arc.File.View.ReadUInt32(offset + 0xC),
                BPP          = arc.File.View.ReadInt32(offset + 0x10),
                OffsetX      = arc.File.View.ReadInt32(offset + 0x14),
                OffsetY      = arc.File.View.ReadInt32(offset + 0x18),
                CanvasWidth  = arc.File.View.ReadUInt32(offset + 0x1C),
                CanvasHeight = arc.File.View.ReadUInt32(offset + 0x20),
            };
            var input = arc.File.CreateStream(entry.Offset, entry.Size);

            return(new Hg3Reader(input, info));
        }
Beispiel #4
0
        public override Stream OpenEntry(ArcFile arc, Entry entry)
        {
            // emulate TGA image
            var offset = entry.Offset + 8;
            var info   = new HgMetaData
            {
                HeaderSize   = arc.File.View.ReadUInt32(offset),
                Width        = arc.File.View.ReadUInt32(offset + 8),
                Height       = arc.File.View.ReadUInt32(offset + 0xC),
                BPP          = arc.File.View.ReadInt32(offset + 0x10),
                OffsetX      = arc.File.View.ReadInt32(offset + 0x14),
                OffsetY      = arc.File.View.ReadInt32(offset + 0x18),
                CanvasWidth  = arc.File.View.ReadUInt32(offset + 0x1C),
                CanvasHeight = arc.File.View.ReadUInt32(offset + 0x20),
            };

            using (var input = arc.File.CreateStream(entry.Offset, entry.Size))
                using (var reader = new Hg3Reader(input, info))
                {
                    var pixels = reader.Unpack();
                    return(TgaStream.Create(info, pixels, reader.Flipped));
                }
        }
Beispiel #5
0
 public Hg3Reader(Stream input, HgMetaData info) : base(input, info)
 {
 }