Esempio n. 1
0
        private static byte[] UncompressRow(byte transparencyIndex, int rowLength, byte[] compressedData)
        {
            var uncompressedDataStream = new MemoryStream();

            CompressedFrameReader.DecompressRow(compressedData, uncompressedDataStream, rowLength, transparencyIndex);
            return(uncompressedDataStream.ToArray());
        }
Esempio n. 2
0
        private static byte[] CompressAndUncompressImage(byte transparencyIndex, int width, byte[] data)
        {
            var compressedData = CompressImage(transparencyIndex, width, data);

            return(CompressedFrameReader.ReadCompressedImage(new BinaryReader(new MemoryStream(compressedData, false)), width, data.Length / width, transparencyIndex));
        }
Esempio n. 3
0
        public void TestUncompressThisRow()
        {
            var data = new byte[]
            {
                0x09,
                0x00,
                0x2e,
                0x07,
                0x00,
                0xad,
                0x03,
                0x00,
                0x2e,
                0x03,
                0x10,
                0xaf,
                0xf5,
                0x2f,
                0xaf,
                0xf5,
                0x03,

                0x0c,
                0xf5,
                0xaf,
                0x5f,
                0x5f,
                0x0b,
            };

            var data2 = new byte[]
            {
                0x09,
                0x00,
                0x2e,
                0x07,
                0x00,
                0xad,
                0x03,
                0x00,
                0x2e,
                0x03,
                0x10,
                0xaf,
                0xf5,
                0x2f,
                0xaf,
                0xf5,
                0x03,

                0x04,
                0xf5,
                0xaf,
                0x06,
                0x5f,
                0x0b,
            };

            var s = new MemoryStream();

            CompressedFrameReader.DecompressRow(data, s, 27, 9);
            var ss = s.ToArray();

            var s2 = new MemoryStream();

            CompressedFrameReader.DecompressRow(data2, s2, 27, 9);
            var ss2 = s.ToArray();

            CollectionAssert.AreEqual(ss, ss2);
        }