Пример #1
0
        public override void Flushing(AuroraUdpStreamer sender, Layout layout)
        {
            var ms = Stopwatch.StartNew();

            int x = X.Length;
            int y = X.Width;

            using (var img = new ImageFactory().GetCameraFrame())
            {
                var colors = img.BlockifyColors(y, x);
                var tiles  = X.ToArray();

                for (int i = 0; i < tiles.Length; i++)
                {
                    var rc = colors[i];
                    var rt = tiles[i];

                    for (int j = 0; j < rt.Length; j++)
                    {
                        try
                        {
                            var c = rc[j];
                            var t = rt[j];
                            t.Color    = new TileColor(c.R, c.G, c.B);
                            t.Duration = 5;
                        }
                        catch (Exception e)
                        {
                        }
                    }
                }
            }
            ms.Stop();

            Console.WriteLine($"Updated in {ms.ElapsedMilliseconds}ms");
        }