Example #1
0
        protected byte[] DecodeSmap(Chunk smapChunk, ImageInfo info)
        {
            byte[] buffer = new byte[info.Width * info.Height];

            int stripCount = info.Width / 8;

            Chunk offsChunk = smapChunk.SelectSingle("BSTR/WRAP/OFFS");

            int[] stripOffsets = new int[stripCount];

            BinReader reader = offsChunk.GetReader();

            reader.Position = 8;
            for (int i = 0; i < stripCount; i++)
            {
                int offs = reader.ReadS32LE();
                stripOffsets[i] = (int)(offs - offsChunk.Size);
            }
            uint dataSize = offsChunk.Parent.Size - offsChunk.Size - 8;

            SRFile file = smapChunk.File;

            file.Position = offsChunk.Offset + offsChunk.Size;
            byte[] source;
            file.Read(dataSize, out source);

            return(MMucusImageDecoder.DecodeStrips(info, source, buffer, stripOffsets));
        }
Example #2
0
        protected byte[] DecodeSmap(Chunk dataChunk, ImageInfo info)
        {
            byte[] buffer = new byte[info.Width * info.Height];

            int stripCount = info.Width / 8;

            int[] stripOffsets = new int[stripCount];

            BinReader reader = dataChunk.GetReader();

            reader.Position = 8;
            for (int i = 0; i < stripCount; i++)
            {
                int offs = reader.ReadS32LE();
                stripOffsets[i] = offs - 8 - 4 * stripCount;
            }
            uint dataOffset = (uint)(8 + 4 * stripCount);
            uint dataSize   = dataChunk.Size - dataOffset;

            reader.Position = dataOffset;
            byte[] source;
            reader.Read(dataSize, out source);

            return(MMucusImageDecoder.DecodeStrips(info, source, buffer, stripOffsets));
        }
Example #3
0
        protected byte[] DecodeBomp(Chunk dataChunk, ImageInfo info)
        {
            byte[] dest = new byte[info.Width * info.Height];

            BinReader reader = dataChunk.GetReader();

            reader.Position = 18;
            byte[] source;
            reader.Read(dataChunk.Size - 18, out source);

            MMucusImageDecoder.DecodeBomp(info, source, dest);

            return(dest);
        }
Example #4
0
        protected byte[] DecodeSmap(Chunk smapChunk, ImageInfo info)
        {
            byte[] buffer = new byte[info.Width * info.Height];

            int stripCount = info.Width / 8;

            int[] stripOffsets = new int[stripCount];

            BinReader reader = smapChunk.GetReader();

            reader.Position = 10;
            for (int i = 0; i < stripCount; i++)
            {
                int offs = reader.ReadS32LE();
                stripOffsets[i] = offs - stripCount * 4 - 4; // Strip offsets are relative to offset 6
            }
            uint dataSize = (uint)(smapChunk.Size - stripCount * 4 - 10);

            byte[] source;
            reader.Read(dataSize, out source);

            return(MMucusImageDecoder.DecodeStrips(info, source, buffer, stripOffsets));
        }