public void When_generating_combinaisons()
        {
            int colorPalette = 255 / 8;

            var stopwatch = Stopwatch.StartNew();

            var colors       = new List <ushort>();
            var compressor   = new BitmapCompressor();
            var combinaisons = new List <ushort[, ]>();
            var matrix       = new ushort[BlockSize, BlockSize];

            Int64 count = 0;

            for (byte red = 0; red < 255; red++)
            {
                for (byte green = 0; green < 255; green++)
                {
                    for (byte blue = 0; blue < 255; blue++)
                    {
                        colors.Add(compressor.CompressColor(Color.FromArgb(red, green, blue)));
                        count++;
                    }
                }
            }

            colors = colors.Distinct().ToList();

            for (int x = 0; x < BlockSize; x++)
            {
                for (int y = 0; y < BlockSize; y++)
                {
                    foreach (var color in colors)
                    {
                        matrix[x, y] = color;
                        var copy = CopyMatrix(matrix, BlockSize, BlockSize);
                        combinaisons.Add(copy);
                    }
                }
            }

            stopwatch.Stop();
            var elapsed = stopwatch.Elapsed;
        }
        public void When_store_with_BitmapCompressor()
        {
            var bytes1 = File.ReadAllBytes("Files/webcam_screenshot1.jpg");

            var stopwatch = Stopwatch.StartNew();

            var memoryStream  = new MemoryStream(bytes1);
            var image         = Image.FromStream(memoryStream);
            var bitmap        = new Bitmap(image);
            var blocksBuilder = new BlocksBuilder(bitmap);
            var pixelsBlocks  = new List <PixelsBlock>();

            for (int i = 0; i < blocksBuilder.GetBlockCount(); i++)
            {
                var block = blocksBuilder.GetPixelsBlock(i);
                pixelsBlocks.Add(block);
            }

            var compressor = new BitmapCompressor();

            using (FileStream fileStream = File.OpenWrite("out.compressed"))
                using (var writer = new BinaryWriter(fileStream))
                {
                    foreach (var block in pixelsBlocks)
                    {
                        foreach (Pixel pixel in block.Pixels)
                        {
                            ushort color = compressor.CompressColor(pixel.Color);
                            writer.Write(color);
                        }
                    }

                    fileStream.Flush(true);
                }

            stopwatch.Stop();
            var elapsed = stopwatch.Elapsed;
        }