Example #1
0
        /// <inheritdoc />
        protected override void RenderInternal()
        {
            var graphics = BackBuffer.Graphics;

            var t = DateTime.UtcNow.Millisecond / 1000.0;

            Color GetColor(int x, int y) => Color.FromArgb
            (
                byte.MaxValue,
                (byte)((double)x / BufferSize.Width * byte.MaxValue),
                (byte)((double)y / BufferSize.Height * byte.MaxValue),
                (byte)(Math.Sin(t * Math.PI) * byte.MaxValue)
            );

            Parallel.For(0, BackBuffer.Buffer.Length, index =>
            {
                BackBuffer.GetXY(index, out var x, out var y);
                BackBuffer.Buffer[index] = GetColor(x, y).ToArgb();
            });
Example #2
0
        public void Render()
        {
            lock (_updateLock)
            {
                FpsCounter.StartFrame();
                Task.Delay(10).Wait();
                var t = DateTime.UtcNow.Millisecond / 1000.0;
                Color GetColor(int x, int y) => Color.FromArgb
                (
                    byte.MaxValue,
                    (byte)((double)x / _bufferSize.Width * byte.MaxValue),
                    (byte)((double)y / _bufferSize.Height * byte.MaxValue),
                    (byte)(Math.Sin(t * Math.PI) * byte.MaxValue)
                );

                Parallel.For(0, BackBuffer.Buffer.Length, index =>
                {
                    BackBuffer.GetXY(index, out var x, out var y);
                    BackBuffer.Buffer[index] = GetColor(x, y).ToArgb();
                });