private void SourceOnProgressChanged(object sender, TimeSpan progress) { if (Sampler == null) { return; } if (Frames == null) { _colors = Sampler.GetColors(progress, Samples); } else { double frame = progress.TotalSeconds * Frames.DurationDenominator * Frames.TotalFramesInVideo / Frames.DurationNumerator; int lastIndex = (int)Math.Round(frame); int firstIndex = lastIndex - Samples + 1; lastIndex = ClampInt(lastIndex, 0, Frames.Count); firstIndex = ClampInt(firstIndex, 0, Frames.Count); _colors = Frames.Skip(firstIndex - 1).Take(lastIndex - firstIndex) .Select(p => SampleCondition.GetAverageColor(p.Capture)).Reverse().ToList(); } InvalidateVisual(); }
private void SourceOnProgressChanged(object sender, TimeSpan progress) { if (Sampler == null) { return; } _colors = Sampler.GetColors(progress, Samples); InvalidateVisual(); }