public HighlightBuffer(MegacoolRecording recording) { this.maxFrames = recording.MaxFrames; this.recording = recording; curHighlight = new HighlightWindow(0, 0, 0); curWindow = new HighlightWindow(0, 0, 0); frameScore = 0; frameScores = new List <int>(); maxIntensity = 0; boringFrameNumber = 0; frameNumber = 0; CalculateFramesAfterPeak(recording); }
/// <summary> /// Create highlighter window /// </summary> public void InitializeWindow() { canvas = new Canvas(); var vb = new Viewbox() { Child = canvas }; this.HighlightWindow = new Window() { Content = vb, Title = Properties.Resources.ScreenshotWindowTitle, Icon = Application.Current.MainWindow.Icon, MinHeight = 80 }; bdClick = new Border() { Child = new TextBlock() { FontSize = 28, Text = Properties.Resources.ScreenshotWindowTitle, Background = new SolidColorBrush(Colors.White), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }, Width = 620, Height = 70, Visibility = Visibility.Collapsed, BorderBrush = System.Windows.Media.Brushes.Red, BorderThickness = new Thickness(5), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; this.HighlightWindow.Closing += onClosing; this.HighlightWindow.Closed += onClosed; this.HighlightWindow.MouseDown += onClick; this.HighlightWindow.MouseEnter += onClick; canvas.Width = Dimensions.Width; canvas.Height = Dimensions.Height; canvas.Children.Add(bdClick); bdClick.SetValue(Canvas.LeftProperty, (canvas.Width - bdClick.Width) / 2); bdClick.SetValue(Canvas.TopProperty, (canvas.Height - bdClick.Height) / 2); canvas.Background = ib; if (WinRect.IsEmpty) { var xyDpi = Desktop.Utility.ExtensionMethods.GetWPFWindowPositioningDPI(); this.HighlightWindow.Top = Dimensions.Top / xyDpi; this.HighlightWindow.Left = Dimensions.Left / xyDpi; var dpi = Dimensions.GetDPI(); this.HighlightWindow.Width = Dimensions.Width / dpi; this.HighlightWindow.Height = Dimensions.Height / dpi; } else { this.HighlightWindow.Top = WinRect.Top; this.HighlightWindow.Left = WinRect.Left; this.HighlightWindow.Width = WinRect.Width; this.HighlightWindow.Height = WinRect.Height; } HighlightWindow.Show(); }