public FrameDisplay() { InitializeComponent(); SizeChanged += FrameDisplay_SizeChanged; _frame = new Frame(0); _width = ConfigConstant.GetInt("FRAME_WIDTH"); _height = ConfigConstant.GetInt("FRAME_HEIGHT"); Dad.Columns = _width; Dad.Rows = _height; pixels = new DrawablePixel[_width * _height]; for (int i = 0; i < _height; i++) { for (int j = 0; j < _width; j++) { DrawablePixel pixel = new DrawablePixel(this, GridHelper.GetGridNumber(i, j)); pixel.SetValue(Grid.RowProperty, i); pixel.SetValue(Grid.ColumnProperty, j); Dad.Children.Add(pixel); pixels[GridHelper.GetGridNumber(i, j)] = pixel; } } }
public FramePreview() { InitializeComponent(); SizeChanged += FrameDisplay_SizeChanged; _frame = new Frame(0); _width = ConfigConstant.GetInt("FRAME_WIDTH"); _height = ConfigConstant.GetInt("FRAME_HEIGHT"); pixels = new PixelDisplay[_width * _height]; for (int i = 0; i < _height; i++) { StackPanel stackPanel = new StackPanel(); stackPanel.Orientation = Orientation.Horizontal; for (int j = 0; j < _width; j++) { PixelDisplay pixel = new PixelDisplay(this, _frame.GetPixel(i, j)); stackPanel.Children.Add(pixel); pixels[GridHelper.GetGridNumber(i, j)] = pixel; } Dad.Children.Add(stackPanel); } Update(); }
// Refresh the display according to the Frame property public void Update() { int width = ConfigConstant.GetInt("FRAME_WIDTH"); int height = ConfigConstant.GetInt("FRAME_HEIGHT"); for (int i = 0; i < width * height; i++) { pixels[i].Rect.Fill = new SolidColorBrush(Frame.GetPixel(i).Color); } }
public Frame(int number) { Number = number; int width = ConfigConstant.GetInt("FRAME_WIDTH"); int height = ConfigConstant.GetInt("FRAME_HEIGHT"); Pixels = new Pixel[width * height]; for (int i = 0; i < Pixels.Length; i++) { Pixels[i] = new Pixel(); } }
// Refresh the display according to the Frame property public void Update() { NumberDisplay.Text = $"Frame: {_frame.Number + 1}"; int width = ConfigConstant.GetInt("FRAME_WIDTH"); int height = ConfigConstant.GetInt("FRAME_HEIGHT"); for (int i = 0; i < width * height; i++) { pixels[i].Rect.Fill = new SolidColorBrush(_frame.GetPixel(i).Color); } }