diff --git a/Matrix App.sln.DotSettings.user b/Matrix App.sln.DotSettings.user new file mode 100644 index 0000000..c84de24 --- /dev/null +++ b/Matrix App.sln.DotSettings.user @@ -0,0 +1,5 @@ + + False + False + True + True \ No newline at end of file diff --git a/Matrix App/Defaults.cs b/Matrix App/Defaults.cs index 5c17d52..ecace51 100644 --- a/Matrix App/Defaults.cs +++ b/Matrix App/Defaults.cs @@ -1,49 +1,48 @@  -namespace MatrixDesigner +namespace Matrix_App { - public sealed class Defaults + public static class Defaults { - public static readonly int PORT_NAME_UPDATE_INTERVAL = 5000; + public const int PortNameUpdateInterval = 5000; - public static readonly int MATRIX_START_WIDTH = 10; - public static readonly int MATRIX_START_HEIGHT = 10; - public static readonly int MATRIX_START_FRAMES = 1; + public const int MatrixStartWidth = 10; + public const int MatrixStartHeight = 10; + public const int MatrixStartFrames = 1; - public static readonly int MATRIX_LIMITED_WIDTH = 512; - public static readonly int MATRIX_LIMITED_HEIGHT = 512; + public const int MatrixLimitedWidth = 512; + public const int MatrixLimitedHeight = 512; - public static readonly int BAUD_RATE = 9600; + public const int BaudRate = 9600; - public static readonly int READ_TIMEOUT_MS = 5500; - public static readonly int WRITE_TIMEOUT_MS = 5500; + public const int ReadTimeoutMs = 5500; + public const int WriteTimeoutMs = 5500; /// /// Total count of LEDs at start /// - public static readonly int MATRIX_START_LED_COUNT = MATRIX_START_WIDTH * MATRIX_START_HEIGHT * BPP; + public static readonly int MATRIX_START_LED_COUNT = MatrixStartWidth * MatrixStartHeight * Bpp; /// /// Number of Bytes Per Pixel: 3 cause Red (1 byte) + Blue (1 Byte) + Green (1 byte) = 3 /// - public static readonly int BPP = 3; + public const int Bpp = 3; - public static readonly int FILTER_PREVIEW_WIDTH = 32; - public static readonly int FILTER_PREVIEW_HEIGHT = 32; + public const int FilterPreviewWidth = 32; + public const int FilterPreviewHeight = 32; - public static readonly int ARDUINO_SUCCESS_BYTE = 21; + public const int ArduinoSuccessByte = 21; - public static readonly int ARDUINO_COMMAND_QUEUE_SIZE = 5; - public static readonly int ARDUINO_RECIVCE_BUFFER_SIZE = 1 + 1 + 1 + MATRIX_LIMITED_WIDTH * MATRIX_LIMITED_HEIGHT; + public const int ArduinoCommandQueueSize = 5; + public const int ArduinoReceiveBufferSize = 1 + 1 + 1 + MatrixLimitedWidth * MatrixLimitedHeight; - public static readonly int DEQUEUE_WAIT_TIMEOUT_COUNTER = 2; + public const int DequeueWaitTimeoutCounter = 2; } - public sealed class ArduinoInstruction + public static class ArduinoInstruction { - public static readonly byte OPCODE_SCALE = 0; -// public static readonly byte OPCODE_SINGLE = 1; - public static readonly byte OPCODE_IMAGE = 2; - public static readonly byte OPCODE_FILL = 3; + public const byte OpcodeScale = 0; + public const byte OpcodeImage = 2; + public const byte OpcodeFill = 3; public static readonly byte OPCODE_CONFIG = 4; } } \ No newline at end of file diff --git a/Matrix App/GifGeneratorUtils.cs b/Matrix App/GifGeneratorUtils.cs index b7a462c..8a04eab 100644 --- a/Matrix App/GifGeneratorUtils.cs +++ b/Matrix App/GifGeneratorUtils.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Text; -using static MatrixDesigner.Defaults; +using static Matrix_App.Defaults; namespace Matrix_App { @@ -94,7 +94,7 @@ namespace Matrix_App public static void SampleFrame(in byte[][] sampler, int frame, int x, int y, int width, out float r, out float g, out float b) { - var index = (x + y * width) * BPP; + var index = (x + y * width) * Bpp; // normalize pixel value to [0, 1] r = sampler[frame][index + 0] * 0.00392156862745f; diff --git a/Matrix App/Matrix App.csproj b/Matrix App/Matrix App.csproj index 3c543a7..4f76f74 100644 --- a/Matrix App/Matrix App.csproj +++ b/Matrix App/Matrix App.csproj @@ -27,6 +27,7 @@ True Resources.resx + @@ -34,5 +35,8 @@ ResXFileCodeGenerator Resources.Designer.cs + + + \ No newline at end of file diff --git a/Matrix App/MatrixDesigner.Designer.cs b/Matrix App/MatrixDesigner.Designer.cs index c486205..501dcc2 100644 --- a/Matrix App/MatrixDesigner.Designer.cs +++ b/Matrix App/MatrixDesigner.Designer.cs @@ -486,7 +486,7 @@ namespace Matrix_App this.ZeichnenTextBoxRed.TabIndex = 4; this.ZeichnenTextBoxRed.Text = "0"; this.ZeichnenTextBoxRed.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.ZeichnenTextBoxRed.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ZeichnenTextBoxRed_KeyUp); + this.ZeichnenTextBoxRed.KeyUp += new System.Windows.Forms.KeyEventHandler(this.DrawTextBoxRed_KeyUp); // // ZeichnenTrackBarRed // @@ -529,7 +529,7 @@ namespace Matrix_App this.ZeichnenTextBoxBlue.TabIndex = 6; this.ZeichnenTextBoxBlue.Text = "0"; this.ZeichnenTextBoxBlue.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.ZeichnenTextBoxBlue.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ZeichnenTextBoxBlue_KeyUp); + this.ZeichnenTextBoxBlue.KeyUp += new System.Windows.Forms.KeyEventHandler(this.DrawTextBoxBlue_KeyUp); // // ZeichnenTextBoxGreen // @@ -539,7 +539,7 @@ namespace Matrix_App this.ZeichnenTextBoxGreen.TabIndex = 5; this.ZeichnenTextBoxGreen.Text = "0"; this.ZeichnenTextBoxGreen.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.ZeichnenTextBoxGreen.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ZeichnenTextBoxGreen_KeyUp); + this.ZeichnenTextBoxGreen.KeyUp += new System.Windows.Forms.KeyEventHandler(this.DrawTextBoxGreen_KeyUp); // // Clear // @@ -552,7 +552,7 @@ namespace Matrix_App this.Clear.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.Clear.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.Clear.UseVisualStyleBackColor = true; - this.Clear.Click += new System.EventHandler(this.ZeichnenClear_Click); + this.Clear.Click += new System.EventHandler(this.DrawClear_Click); // // fill // @@ -565,7 +565,7 @@ namespace Matrix_App this.fill.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.fill.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.fill.UseVisualStyleBackColor = true; - this.fill.Click += new System.EventHandler(this.ZeichnenFill_Click); + this.fill.Click += new System.EventHandler(this.DrawFill_Click); // // ZeichnenFarbRad // diff --git a/Matrix App/MatrixDesigner.cs b/Matrix App/MatrixDesigner.cs index 2c52524..4b3d9a6 100644 --- a/Matrix App/MatrixDesigner.cs +++ b/Matrix App/MatrixDesigner.cs @@ -3,27 +3,22 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; +using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; using System.IO.Ports; using System.Timers; -using System.Diagnostics; -using System.Drawing.Drawing2D; using System.Drawing.Imaging; -using System.Runtime.CompilerServices; using System.IO; using System.Management; using System.Text.RegularExpressions; -using static MatrixDesigner.Defaults; -using static MatrixDesigner.ArduinoInstruction; +using static Matrix_App.Defaults; +using static Matrix_App.ArduinoInstruction; using static Matrix_App.Utils; using Matrix_App.Themes; +using Timer = System.Timers.Timer; namespace Matrix_App { @@ -35,21 +30,21 @@ namespace Matrix_App /// Port update Timer /// Reloads available port names at consecutive rates /// - private System.Timers.Timer portNameUpdater; - private System.Timers.Timer delay; + private Timer? portNameUpdater; + private Timer? delay; - private static SerialPort port = new SerialPort(); + private static SerialPort _port = new SerialPort(); private uint portNumber; - private bool runningGif = false; + private bool runningGif; - private PortCommandQueue commandQueue = new PortCommandQueue(ref port); - private Regex comRegex = new Regex(@"COM[\d]+"); + private readonly PortCommandQueue commandQueue = new PortCommandQueue(ref _port); + private readonly Regex comRegex = new Regex(@"COM[\d]+"); /// /// Gif like frame video buffer /// - public byte[][] Gif = CreateImageRGB_NT(MATRIX_START_WIDTH, MATRIX_START_HEIGHT, MATRIX_START_FRAMES); + public byte[][] gifBuffer = CreateImageRGB_NT(MatrixStartWidth, MatrixStartHeight, MatrixStartFrames); #endregion @@ -64,36 +59,36 @@ namespace Matrix_App // Generate filter access buttons MatrixGifGenerator.GenerateBaseUi(pregeneratedModsBase, matrixView, this); - init(); - // apply lightmode by default + Init(); + // apply light-mode by default new LightMode().ApplyTheme(this); } - - private void init() + + private void Init() { // Create port name update timer - portNameUpdater = new System.Timers.Timer(PORT_NAME_UPDATE_INTERVAL); - portNameUpdater.Elapsed += updatePortNames; + portNameUpdater = new Timer(PortNameUpdateInterval); + portNameUpdater.Elapsed += UpdatePortNames; portNameUpdater.AutoReset = true; portNameUpdater.Enabled = true; // create gif playback timer - delay = new System.Timers.Timer((int) Delay.Value); - delay.Elapsed += timelineupdate; + delay = new Timer((int) Delay.Value); + delay.Elapsed += Timelineupdate; delay.AutoReset = true; // Set color wheel event handler - ZeichnenFarbRad.handler = new EventHandler(FarbRad_Handler); + ZeichnenFarbRad.handler = ColorWheel_Handler!; // setup port settings - port.BaudRate = BAUD_RATE; - port.ReadTimeout = READ_TIMEOUT_MS; - port.WriteTimeout = WRITE_TIMEOUT_MS; + _port.BaudRate = BaudRate; + _port.ReadTimeout = ReadTimeoutMs; + _port.WriteTimeout = WriteTimeoutMs; // setup matrix AdjustMatrixTable(); - // search for inital ports + // search for initial ports GatherPortNames(); HideEasterEgg(); @@ -101,32 +96,31 @@ namespace Matrix_App private void HideEasterEgg() { - Random better = new Random(); - int Brandom = better.Next(0, 9); - if (Brandom < 1) + if (((int) DateTime.Now.DayOfWeek) != 3) + return; + + if (new Random().Next(0, 9) <= 1) + return; + + using (Bitmap wednesdayFrog = new Bitmap(Properties.Resources.Frosch)) { - if (((int)DateTime.Now.DayOfWeek) == 3) + matrixWidth.Value = wednesdayFrog.Width; + matrixHeight.Value = wednesdayFrog.Height; + ResizeGif(); + + for (var x = 0; x < wednesdayFrog.Width; x++) { - matrixWidth.Value = 16; - matrixHeight.Value = 16; - ResizeGif(); - Bitmap WednesdayFrog = new Bitmap(Matrix_App.Properties.Resources.Frosch); - - for (int x = 0; x < WednesdayFrog.Width; x++) + for (var y = 0; y < wednesdayFrog.Height; y++) { - for (int y = 0; y < WednesdayFrog.Height; y++) - { - var pixel = WednesdayFrog.GetPixel(x, y); + var pixel = wednesdayFrog.GetPixel(x, y); - int index = x + y * WednesdayFrog.Width; + matrixView.SetPixelNoRefresh(x, y, pixel); - matrixView.SetPixelNoRefresh(x, y, pixel); - - } } - matrixView.Refresh(); } } + + matrixView.Refresh(); } #endregion @@ -140,12 +134,12 @@ namespace Matrix_App /// /// /// - private void updatePortNames(Object source, ElapsedEventArgs e) + private void UpdatePortNames(object source, ElapsedEventArgs e) { if (Ports.InvokeRequired) { - // invoke on the comboboxes thread - Ports.Invoke(new Action(() => GatherPortNames())); + // invoke on the combo-boxes thread + Ports.Invoke(new Action(GatherPortNames)); } else { @@ -155,8 +149,9 @@ namespace Matrix_App } /// - /// Gathers all availbale ports and sets them to the combobox + /// Gathers all available ports and sets them to the combobox /// + [SuppressMessage("ReSharper", "CoVariantArrayConversion", Justification = "Never got an exception, so seems to be just fine")] private void GatherPortNames() { var ports = SerialPort.GetPortNames(); @@ -180,15 +175,15 @@ namespace Matrix_App Ports.Items.Clear(); - Ports.Items.AddRange(newPorts.ToArray()); + Ports.Items.AddRange(newPorts.ToArray()!); // select previously selected port if port is still accessible - if (selected != null && this.Ports.Items.Contains(selected)) + if (selected != null && Ports.Items.Contains(selected)) { - this.Ports.SelectedItem = selected; + Ports.SelectedItem = selected; } else { - this.Ports.SelectedIndex = 0; + Ports.SelectedIndex = 0; } break; } @@ -198,20 +193,21 @@ namespace Matrix_App private static LinkedList GetDeviceNames(string[] ports) { ManagementClass processClass = new ManagementClass("Win32_PnPEntity"); - ManagementObjectCollection Ports = processClass.GetInstances(); + ManagementObjectCollection devicePortNames = processClass.GetInstances(); var newPorts = new LinkedList(); - for (var x = 0; x < ports.Length; x++) + foreach (var currentPort in ports) { - foreach (ManagementObject property in Ports) + foreach (var o in devicePortNames) { - var name = property.GetPropertyValue("Name"); - if (name != null && name.ToString().Contains(ports[x])) - { - newPorts.AddLast(name.ToString()); - break; - } + var name = ((ManagementObject) o).GetPropertyValue("Name"); + + if (name == null || !name.ToString()!.Contains(currentPort)) + continue; + + newPorts.AddLast(name.ToString()!); + break; } } @@ -226,9 +222,9 @@ namespace Matrix_App /// private void Ports_SelectedIndexChanged(object sender, EventArgs e) { - lock (port) + lock (_port) { - if (!port.IsOpen) + if (!_port.IsOpen) { var item = (string)((ComboBox)sender).SelectedItem; if (item != null) @@ -244,18 +240,18 @@ namespace Matrix_App if (portNumber <= 256) { // set valid port - port.PortName = matches[0].Value; + _port.PortName = matches[0].Value; commandQueue.ValidatePort(); } else if (portNumber == 257) { // virtual mode, increase limitations as no real arduino is connected - matrixWidth.Maximum = MATRIX_LIMITED_WIDTH; - matrixHeight.Maximum = MATRIX_LIMITED_HEIGHT; + matrixWidth.Maximum = MatrixLimitedWidth; + matrixHeight.Maximum = MatrixLimitedHeight; } else { // no port selected reset settings - matrixWidth.Maximum = MATRIX_START_WIDTH; - matrixHeight.Maximum = MATRIX_START_HEIGHT; + matrixWidth.Maximum = MatrixStartWidth; + matrixHeight.Maximum = MatrixStartHeight; } } } @@ -283,7 +279,7 @@ namespace Matrix_App { AdjustMatrixTable(); commandQueue.EnqueueArduinoCommand( - OPCODE_SCALE, // opcode + OpcodeScale, // opcode (byte)matrixWidth.Value, (byte)matrixHeight.Value ); @@ -293,7 +289,7 @@ namespace Matrix_App { AdjustMatrixTable(); commandQueue.EnqueueArduinoCommand( - OPCODE_SCALE, // opcode + OpcodeScale, // opcode (byte)matrixWidth.Value, (byte)matrixHeight.Value ); @@ -304,7 +300,7 @@ namespace Matrix_App #region Edit/Draw #region TextBoxen - private void ZeichnenTextBoxRed_KeyUp(object sender, KeyEventArgs e) + private void DrawTextBoxRed_KeyUp(object sender, KeyEventArgs e) { if (int.TryParse(ZeichnenTextBoxRed.Text, out var value) && value < 256 && value >= 0) { @@ -314,13 +310,13 @@ namespace Matrix_App else if (value >= 256) { ZeichnenTrackBarRed.Value = 255; - ZeichnenTextBoxRed.Text = "255"; + ZeichnenTextBoxRed.Text = @"255"; ZeichnenFarbRad.setRGB((byte)ZeichnenTrackBarRed.Value, (byte)ZeichnenTrackBarGreen.Value, (byte)ZeichnenTrackBarBlue.Value); } matrixView.SetPaintColor(Color.FromArgb(ZeichnenTrackBarRed.Value, ZeichnenTrackBarGreen.Value, ZeichnenTrackBarBlue.Value)); } - private void ZeichnenTextBoxGreen_KeyUp(object sender, KeyEventArgs e) + private void DrawTextBoxGreen_KeyUp(object sender, KeyEventArgs e) { if (int.TryParse(ZeichnenTextBoxGreen.Text, out var value) && value < 256 && value >= 0) { @@ -330,14 +326,14 @@ namespace Matrix_App else if (value >= 256) { ZeichnenTrackBarGreen.Value = 255; - ZeichnenTextBoxGreen.Text = "255"; + ZeichnenTextBoxGreen.Text = @"255"; ZeichnenFarbRad.setRGB((byte)ZeichnenTrackBarRed.Value, (byte)ZeichnenTrackBarGreen.Value, (byte)ZeichnenTrackBarBlue.Value); } matrixView.SetPaintColor(Color.FromArgb(ZeichnenTrackBarRed.Value, ZeichnenTrackBarGreen.Value, ZeichnenTrackBarBlue.Value)); } - private void ZeichnenTextBoxBlue_KeyUp(object sender, KeyEventArgs e) + private void DrawTextBoxBlue_KeyUp(object sender, KeyEventArgs e) { if (int.TryParse(ZeichnenTextBoxBlue.Text, out var value) && value < 256 && value >= 0) { @@ -347,7 +343,7 @@ namespace Matrix_App else if (value >= 256) { ZeichnenTrackBarBlue.Value = 255; - ZeichnenTextBoxBlue.Text = "255"; + ZeichnenTextBoxBlue.Text = @"255"; ZeichnenFarbRad.setRGB((byte)ZeichnenTrackBarRed.Value, (byte)ZeichnenTrackBarGreen.Value, (byte)ZeichnenTrackBarBlue.Value); } matrixView.SetPaintColor(Color.FromArgb(ZeichnenTrackBarRed.Value, ZeichnenTrackBarGreen.Value, ZeichnenTrackBarBlue.Value)); @@ -400,7 +396,7 @@ namespace Matrix_App /// /// /// - private void FarbRad_Handler(object sender, EventArgs e) + private void ColorWheel_Handler(object sender, EventArgs e) { ZeichnenTrackBarRed.Value = ZeichnenFarbRad.getRed(); ZeichnenTrackBarGreen.Value = ZeichnenFarbRad.getGreen(); @@ -418,14 +414,14 @@ namespace Matrix_App /// /// /// - private void ZeichnenFill_Click(object sender, EventArgs e) + private void DrawFill_Click(object sender, EventArgs e) { var color = Color.FromArgb(ZeichnenTrackBarRed.Value, ZeichnenTrackBarGreen.Value, ZeichnenTrackBarBlue.Value); matrixView.SetPaintColor(color); matrixView.Fill(color); commandQueue.EnqueueArduinoCommand( - OPCODE_FILL, // Opcode + OpcodeFill, // Opcode (byte)ZeichnenTrackBarRed.Value, // Red (byte)ZeichnenTrackBarGreen.Value,// Green (byte)ZeichnenTrackBarBlue.Value // Blue @@ -437,12 +433,12 @@ namespace Matrix_App /// /// /// - private void ZeichnenClear_Click(object sender, EventArgs e) + private void DrawClear_Click(object sender, EventArgs e) { matrixView.Fill(Color.Black); commandQueue.EnqueueArduinoCommand( - OPCODE_FILL, // opcode + OpcodeFill, // opcode 0, // red 0, // green 0 // blue @@ -460,19 +456,19 @@ namespace Matrix_App /// private void DragDrop_Click(object sender, EventArgs e) { - using (OpenFileDialog openFileDialog = new OpenFileDialog()) + using OpenFileDialog openFileDialog = new OpenFileDialog { - openFileDialog.InitialDirectory = "c:\\"; - openFileDialog.Filter = "image files (*.PNG;*.JPG;*.GIF)|*.*"; - openFileDialog.FilterIndex = 2; - openFileDialog.RestoreDirectory = true; + InitialDirectory = "c:\\", + Filter = @"image files (*.PNG;*.JPG;*.GIF)|*.*", + FilterIndex = 2, + RestoreDirectory = true + }; - if (openFileDialog.ShowDialog() == DialogResult.OK) - { - string filePath = openFileDialog.FileName; + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + string filePath = openFileDialog.FileName; - loadFromFile(filePath); - } + LoadFromFile(filePath); } } @@ -481,18 +477,18 @@ namespace Matrix_App /// If the image is an gif, the gif buffer will be set to the gif, as well as the matrix itself. /// /// - private void loadFromFile(string filePath) + private void LoadFromFile(string filePath) { // load gif if (filePath.ToLower().EndsWith(".gif")) { var gif = Image.FromFile(filePath); - int frames = Math.Min(gif.GetFrameCount(FrameDimension.Time), 120); + var frames = Math.Min(gif.GetFrameCount(FrameDimension.Time), 120); if (gif.GetFrameCount(FrameDimension.Time) > 120) { - MessageBox.Show("Das Gif ist zu Groß. Die Maximalgröße sind 120 Frames. Das Gif wird abgeschnitten sein, damit es in die Maximalgröße passt.", "Gif to large"); + MessageBox.Show(@"Das Gif ist zu Groß. Die Maximalgröße sind 120 Frames. Das Gif wird abgeschnitten sein, damit es in die Maximalgröße passt.", @"Gif to large"); } FrameCount.Value = frames; @@ -501,7 +497,7 @@ namespace Matrix_App ResizeGif(); // fetch and store frames - for (int i = 0; i < frames; i++) + for (var i = 0; i < frames; i++) { gif.SelectActiveFrame(FrameDimension.Time, i); @@ -509,19 +505,19 @@ namespace Matrix_App var bitmap = ResizeImage(gif, matrixView.matrixWidth(), matrixView.matrixHeight()); // fetch each pixel and store - for (int x = 0; x < bitmap.Width; x++) + for (var x = 0; x < bitmap.Width; x++) { - for (int y = 0; y < bitmap.Height; y++) + for (var y = 0; y < bitmap.Height; y++) { var pixel = bitmap.GetPixel(x, y); - int index = x + y * bitmap.Width; + var index = x + y * bitmap.Width; matrixView.SetPixelNoRefresh(x, y, pixel); - Gif[i][index * 3] = pixel.G; - Gif[i][index * 3 + 1] = pixel.R; - Gif[i][index * 3 + 2] = pixel.B; + gifBuffer[i][index * 3] = pixel.G; + gifBuffer[i][index * 3 + 1] = pixel.R; + gifBuffer[i][index * 3 + 2] = pixel.B; } } } @@ -544,13 +540,13 @@ namespace Matrix_App int index = x + y * bitmap.Width; - Gif[Timeline.Value][index * 3] = pixel.G; - Gif[Timeline.Value][index * 3 + 1] = pixel.R; - Gif[Timeline.Value][index * 3 + 2] = pixel.B; + gifBuffer[Timeline.Value][index * 3] = pixel.G; + gifBuffer[Timeline.Value][index * 3 + 1] = pixel.R; + gifBuffer[Timeline.Value][index * 3 + 2] = pixel.B; } } } - writeImage(Gif[Timeline.Value]); + WriteImage(gifBuffer[Timeline.Value]); } private void DragDrop_DragEnter(object sender, DragEventArgs e) @@ -565,7 +561,7 @@ namespace Matrix_App { string[] picturePath = (string[])e.Data.GetData(DataFormats.FileDrop); - loadFromFile(picturePath[0]); + LoadFromFile(picturePath[0]); } #endregion @@ -610,13 +606,13 @@ namespace Matrix_App { int tmp = (index + x) * 3; - var color = Color.FromArgb(Gif[Timeline.Value][tmp + 1], Gif[Timeline.Value][tmp], Gif[Timeline.Value][tmp + 2]); + var color = Color.FromArgb(gifBuffer[Timeline.Value][tmp + 1], gifBuffer[Timeline.Value][tmp], gifBuffer[Timeline.Value][tmp + 2]); matrixView.SetPixelNoRefresh(x, y, color); } } matrixView.Refresh(); - writeImage(Gif[Timeline.Value]); + WriteImage(gifBuffer[Timeline.Value]); } /// @@ -639,14 +635,14 @@ namespace Matrix_App var color = matrixView.GetPixel(x, y); - Gif[Timeline.Value][tmp] = color.G; - Gif[Timeline.Value][tmp + 1] = color.R; - Gif[Timeline.Value][tmp + 2] = color.B; + gifBuffer[Timeline.Value][tmp] = color.G; + gifBuffer[Timeline.Value][tmp + 1] = color.R; + gifBuffer[Timeline.Value][tmp + 2] = color.B; } } } - private void timelineupdate(Object source, ElapsedEventArgs e) + private void Timelineupdate(Object source, ElapsedEventArgs e) { if (Timeline.InvokeRequired) { @@ -672,24 +668,28 @@ namespace Matrix_App /// private void Play_Click(object sender, EventArgs e) { - if (!(FrameCount.Value == 1)) + if (FrameCount.Value != 1) { if (!runningGif) { - Play.Text = "Stop"; + Play.Text = @"Stop"; Timeline.Value = 0; runningGif = true; - delay.Enabled = true; + + if (delay != null) + delay.Enabled = true; - Play.Image = new Bitmap(Matrix_App.Properties.Resources.Stop); + Play.Image = new Bitmap(Properties.Resources.Stop); } else { - Play.Image = new Bitmap(Matrix_App.Properties.Resources.Play); - Play.Text = "Play"; + Play.Image = new Bitmap(Properties.Resources.Play); + Play.Text = @"Play"; runningGif = false; - delay.Enabled = false; + + if (delay != null) + delay.Enabled = false; } } } @@ -698,16 +698,19 @@ namespace Matrix_App { if (runningGif) { - Play.Image = new Bitmap(Matrix_App.Properties.Resources.Play); - Play.Text = "Play"; + Play.Image = new Bitmap(Properties.Resources.Play); + Play.Text = @"Play"; runningGif = false; - delay.Enabled = false; + + if (delay != null) + delay.Enabled = false; } } - private void Delay_ValueChanged(object sender, EventArgs e) + private void Delay_ValueChanged(object sender, EventArgs _) { - delay.Interval = (int)Delay.Value; + if (delay != null) + delay.Interval = (int) Delay.Value; } #endregion @@ -716,28 +719,29 @@ namespace Matrix_App private void Save_Click(object sender, EventArgs e) { - SaveFileDialog save = new SaveFileDialog(); - - save.InitialDirectory = "c:\\"; - save.Filter = "image files (*.PNG;*.JPG;*.GIF)|*.*"; - save.FilterIndex = 2; - save.RestoreDirectory = true; + SaveFileDialog save = new SaveFileDialog + { + InitialDirectory = "c:\\", + Filter = @"image files (*.PNG;*.JPG;*.GIF)|*.*", + FilterIndex = 2, + RestoreDirectory = true + }; if (save.ShowDialog() == DialogResult.OK) { string filePath = save.FileName; - Bitmap[] gifBitmap = new Bitmap[Gif.Length]; + Bitmap[] gifBitmap = new Bitmap[gifBuffer.Length]; GifWriter writer = new GifWriter(File.Create(filePath)); - for (int i = 0; i < FrameCount.Value; i++) + for (var i = 0; i < FrameCount.Value; i++) { gifBitmap[i] = new Bitmap((int)matrixWidth.Value, (int)matrixHeight.Value); - for (int j = 0; j < Gif[i].Length / 3; j++) + for (var j = 0; j < gifBuffer[i].Length / 3; j++) { - int y = j / (int)matrixWidth.Value; - int x = j % (int)matrixWidth.Value; + var y = j / (int)matrixWidth.Value; + var x = j % (int)matrixWidth.Value; - gifBitmap[i].SetPixel(x, y, Color.FromArgb(Gif[i][j * 3 + 1], Gif[i][j * 3], Gif[i][j * 3 + 2])); + gifBitmap[i].SetPixel(x, y, Color.FromArgb(gifBuffer[i][j * 3 + 1], gifBuffer[i][j * 3], gifBuffer[i][j * 3 + 2])); } writer.WriteFrame(gifBitmap[i], (int)Delay.Value); } @@ -759,9 +763,9 @@ namespace Matrix_App this.matrixWidth.Value = width; this.matrixHeight.Value = height; - for (int x = 0; x < width * height * 3; x++) + for (var x = 0; x < width * height * 3; x++) { - Gif[0][x] = data[2 + x]; + gifBuffer[0][x] = data[2 + x]; } Timeline.Value = 1; Timeline.Value = 0; @@ -785,10 +789,10 @@ namespace Matrix_App private void ResizeGif() { int frames = (int)FrameCount.Value; - Gif = new byte[frames + 1][]; + gifBuffer = new byte[frames + 1][]; for (int i = 0; i <= frames; i++) { - Gif[i] = new byte[matrixView.matrixWidth() * matrixView.matrixHeight() * 3]; + gifBuffer[i] = new byte[matrixView.matrixWidth() * matrixView.matrixHeight() * 3]; } } @@ -812,9 +816,9 @@ namespace Matrix_App #region IO-Utils - private void writeImage(byte[] RGBimageData) + private void WriteImage(byte[] rgbImageData) { - commandQueue.EnqueueArduinoCommand(OPCODE_IMAGE, RGBimageData); + commandQueue.EnqueueArduinoCommand(OpcodeImage, rgbImageData); } /// @@ -833,7 +837,7 @@ namespace Matrix_App image[x * 3 + 2] = (byte)(pixels[x] & 0xFF); } - writeImage(image); + WriteImage(image); } #endregion diff --git a/Matrix App/MatrixGifGenerator.cs b/Matrix App/MatrixGifGenerator.cs index e757782..3eccf01 100644 --- a/Matrix App/MatrixGifGenerator.cs +++ b/Matrix App/MatrixGifGenerator.cs @@ -6,7 +6,7 @@ using System.Text.RegularExpressions; using System.Threading; using System.Windows.Forms; using static Matrix_App.Utils; -using static MatrixDesigner.Defaults; +using static Matrix_App.Defaults; using Timer = System.Windows.Forms.Timer; namespace Matrix_App @@ -47,8 +47,8 @@ namespace Matrix_App { PlaybackTimer.Tick += PlaybackFrame; - Snapshot = CreateImageRGB_NT(FILTER_PREVIEW_WIDTH, FILTER_PREVIEW_HEIGHT, 1); - _initialBuffer = CreateImageRGB_NT(FILTER_PREVIEW_WIDTH, FILTER_PREVIEW_HEIGHT, 1); + Snapshot = CreateImageRGB_NT(FilterPreviewWidth, FilterPreviewHeight, 1); + _initialBuffer = CreateImageRGB_NT(FilterPreviewWidth, FilterPreviewHeight, 1); Renderer = new ThreadQueue("Matrix Gif Renderer", 2); } @@ -86,7 +86,7 @@ namespace Matrix_App button.Click += (sender, e) => OpenGeneratorUi(generator, matrix); button.Image = CreateSnapshot(generator); button.TextImageRelation = TextImageRelation.ImageAboveText; - button.Height = FILTER_PREVIEW_HEIGHT * 2; + button.Height = FilterPreviewHeight * 2; anchor.Controls.Add(button); } @@ -96,7 +96,7 @@ namespace Matrix_App { _generator = new RandomPixels(); // put some random pixels in as default initial image to operate on for filter - SetGlobalArgs(FILTER_PREVIEW_WIDTH, FILTER_PREVIEW_HEIGHT, 1, null, _initialBuffer); + SetGlobalArgs(FilterPreviewWidth, FilterPreviewHeight, 1, null, _initialBuffer); InvokeGenerator(); BlockBuffer(); @@ -104,7 +104,7 @@ namespace Matrix_App _generator = matrixGifGenerator; // render filter - SetGlobalArgs(FILTER_PREVIEW_WIDTH, FILTER_PREVIEW_HEIGHT, 1, _initialBuffer, Snapshot); + SetGlobalArgs(FilterPreviewWidth, FilterPreviewHeight, 1, _initialBuffer, Snapshot); InvokeGenerator(); BlockBuffer(); @@ -131,7 +131,7 @@ namespace Matrix_App if (!ShowEditDialog(matrix)) return; - FlipColorStoreRG_GR(_animationBuffer, _form.Gif); + FlipColorStoreRG_GR(_animationBuffer, _form.gifBuffer); _form.ResetTimeline(); } @@ -331,15 +331,15 @@ namespace Matrix_App private static void Initialize(in Matrix matrix) { // Create new initial buffer and copy what ever was in the Gif buffer to it - _initialBuffer = CreateImageRGB_NT(matrix.matrixWidth(), matrix.matrixHeight(), _form.Gif.Length); - FlipColorStoreRG_GR(_form.Gif, _initialBuffer); + _initialBuffer = CreateImageRGB_NT(matrix.matrixWidth(), matrix.matrixHeight(), _form.gifBuffer.Length); + FlipColorStoreRG_GR(_form.gifBuffer, _initialBuffer); // Set Generator args SetGlobalArgs(matrix.matrixWidth(), matrix.matrixHeight(), - _form.Gif.Length - 1, + _form.gifBuffer.Length - 1, _initialBuffer, - CreateImageRGB_NT(matrix.matrixWidth(), matrix.matrixHeight(), _form.Gif.Length) + CreateImageRGB_NT(matrix.matrixWidth(), matrix.matrixHeight(), _form.gifBuffer.Length) ); // Create preview matrix diff --git a/Matrix App/MatrixIconHighres.png b/Matrix App/MatrixIconHighres.png new file mode 100644 index 0000000..8b20aa3 Binary files /dev/null and b/Matrix App/MatrixIconHighres.png differ diff --git a/Matrix App/PortCommandQueue.cs b/Matrix App/PortCommandQueue.cs index ad2a008..21ef6dd 100644 --- a/Matrix App/PortCommandQueue.cs +++ b/Matrix App/PortCommandQueue.cs @@ -8,7 +8,7 @@ using System.Security.Permissions; using System.Text; using System.Threading; -using static MatrixDesigner.Defaults; +using static Matrix_App.Defaults; namespace Matrix_App { @@ -28,7 +28,7 @@ namespace Matrix_App private volatile bool isPortValid = false; - private byte[] recived = new byte[ARDUINO_RECIVCE_BUFFER_SIZE]; + private byte[] recived = new byte[ArduinoReceiveBufferSize]; private int mark; public PortCommandQueue(ref SerialPort port) @@ -62,7 +62,7 @@ namespace Matrix_App int b; mark = 0; - while((b = port.ReadByte()) != ARDUINO_SUCCESS_BYTE) + while((b = port.ReadByte()) != ArduinoSuccessByte) { recived[mark++] = (byte) b; } @@ -113,7 +113,7 @@ namespace Matrix_App portDeliverThread.Start(); } - if (byteWriteQueue.Count < ARDUINO_COMMAND_QUEUE_SIZE) + if (byteWriteQueue.Count < ArduinoCommandQueueSize) { lock (byteWriteQueue) { @@ -153,7 +153,7 @@ namespace Matrix_App timeCount++; Thread.Sleep(500); - wait = timeCount == DEQUEUE_WAIT_TIMEOUT_COUNTER; + wait = timeCount == DequeueWaitTimeoutCounter; } } diff --git a/Matrix App/Program.cs b/Matrix App/Program.cs index 8e072cc..f41a2db 100644 --- a/Matrix App/Program.cs +++ b/Matrix App/Program.cs @@ -1,25 +1,27 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; namespace Matrix_App { - static class Program + internal static class Program { /// /// The main entry point for the application. /// [STAThread] - static void Main() + private static void Main() { - - + SplashScreen.ShowSplashScreen(); + Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MatrixDesignerMain()); + + var designer = new MatrixDesignerMain(); + + SplashScreen.CloseForm(); + + Application.Run(designer); } } } diff --git a/Matrix App/Properties/Resources.Designer.cs b/Matrix App/Properties/Resources.Designer.cs index 4c4173f..0b893c5 100644 --- a/Matrix App/Properties/Resources.Designer.cs +++ b/Matrix App/Properties/Resources.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace Matrix_App.Properties { /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ namespace Matrix_App.Properties { } /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ namespace Matrix_App.Properties { } /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ namespace Matrix_App.Properties { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap Apply { get { @@ -71,7 +71,7 @@ namespace Matrix_App.Properties { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ClearTool { get { @@ -81,7 +81,7 @@ namespace Matrix_App.Properties { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap FillTool { get { @@ -91,7 +91,7 @@ namespace Matrix_App.Properties { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap Frosch { get { @@ -101,7 +101,7 @@ namespace Matrix_App.Properties { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap Gif { get { @@ -111,7 +111,17 @@ namespace Matrix_App.Properties { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Pfüsikuh { + get { + object obj = ResourceManager.GetObject("Pfüsikuh", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap Play { get { @@ -121,7 +131,7 @@ namespace Matrix_App.Properties { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap Save { get { @@ -131,7 +141,7 @@ namespace Matrix_App.Properties { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap Stop { get { diff --git a/Matrix App/Properties/Resources.resx b/Matrix App/Properties/Resources.resx index c36eb57..8432c96 100644 --- a/Matrix App/Properties/Resources.resx +++ b/Matrix App/Properties/Resources.resx @@ -142,4 +142,7 @@ ..\resources\frosch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\pfüsikuh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Matrix App/Resources/pfüsikuh.png b/Matrix App/Resources/pfüsikuh.png new file mode 100644 index 0000000..690d786 Binary files /dev/null and b/Matrix App/Resources/pfüsikuh.png differ diff --git a/Matrix App/SplashScreen.Designer.cs b/Matrix App/SplashScreen.Designer.cs new file mode 100644 index 0000000..4d65c39 --- /dev/null +++ b/Matrix App/SplashScreen.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Matrix_App { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SplashScreen { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SplashScreen() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Matrix_App.SplashScreen", typeof(SplashScreen).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Matrix App/SplashScreen.cs b/Matrix App/SplashScreen.cs new file mode 100644 index 0000000..6d967b4 --- /dev/null +++ b/Matrix App/SplashScreen.cs @@ -0,0 +1,59 @@ +using System.Threading; +using System.Windows.Forms; + +namespace Matrix_App +{ + public class SplashScreen : Form + { + //Delegate for cross thread call to close + private delegate void CloseDelegate(); + + //The type of form to be displayed as the splash screen. + private static SplashScreen? _splashForm; + + private SplashScreen() + { + FormBorderStyle = FormBorderStyle.None; + + Controls.Add(new Label() + { + Image = Properties.Resources.Pfüsikuh + }); + } + + public static void ShowSplashScreen() + { + // Make sure it is only launched once. + if (_splashForm != null) + return; + + _splashForm = new SplashScreen(); + + Thread thread = new Thread(ShowForm) + { + IsBackground = true, Name = "Splash screen management thread" + }; + thread.SetApartmentState(ApartmentState.STA); + thread.Start(); + } + + private static void ShowForm() + { + if (_splashForm != null) Application.Run(_splashForm); + } + + public static void CloseForm() + { + _splashForm?.Invoke(new CloseDelegate(CloseFormInternal)); + } + + private static void CloseFormInternal() + { + if (_splashForm != null) + { + _splashForm.Close(); + _splashForm = null; + } + } + } +} \ No newline at end of file diff --git a/Matrix App/SplashScreen.resx b/Matrix App/SplashScreen.resx new file mode 100644 index 0000000..4ba99c0 --- /dev/null +++ b/Matrix App/SplashScreen.resx @@ -0,0 +1,21 @@ + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Matrix App/Utils.cs b/Matrix App/Utils.cs index 1adc9d6..e9e02b1 100644 --- a/Matrix App/Utils.cs +++ b/Matrix App/Utils.cs @@ -5,7 +5,7 @@ using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Text; -using static MatrixDesigner.Defaults; +using static Matrix_App.Defaults; namespace Matrix_App { @@ -78,7 +78,7 @@ namespace Matrix_App { for (int y = 0; y < height; y++) { - int index = (x + y * width) * BPP; + int index = (x + y * width) * Bpp; image.SetPixel(x, y, Color.FromArgb( (byte) buffer[index + 0], @@ -104,7 +104,7 @@ namespace Matrix_App for (int frame = 0; frame < frames; frame++) { - bytes[frame] = new byte[width * height * BPP]; + bytes[frame] = new byte[width * height * Bpp]; } return bytes; diff --git a/Matrix App/bin/Debug/netcoreapp3.1/Matrix App.dll b/Matrix App/bin/Debug/netcoreapp3.1/Matrix App.dll index bd0c2d5..e23d833 100644 Binary files a/Matrix App/bin/Debug/netcoreapp3.1/Matrix App.dll and b/Matrix App/bin/Debug/netcoreapp3.1/Matrix App.dll differ diff --git a/Matrix App/bin/Debug/netcoreapp3.1/Matrix App.pdb b/Matrix App/bin/Debug/netcoreapp3.1/Matrix App.pdb index 0d6b562..e9c8d6b 100644 Binary files a/Matrix App/bin/Debug/netcoreapp3.1/Matrix App.pdb and b/Matrix App/bin/Debug/netcoreapp3.1/Matrix App.pdb differ diff --git a/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.csproj.CoreCompileInputs.cache b/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.csproj.CoreCompileInputs.cache index 9dc73c2..75a64fd 100644 --- a/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.csproj.CoreCompileInputs.cache +++ b/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -33bf45022f7912fceecdbeaf19d1442e0f0a576f +ee8b86baf58d13435f960406ec4b0be78d0cc26c diff --git a/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.csprojAssemblyReference.cache b/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.csprojAssemblyReference.cache index 30e9c4e..47db198 100644 Binary files a/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.csprojAssemblyReference.cache and b/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.csprojAssemblyReference.cache differ diff --git a/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.dll b/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.dll index bd0c2d5..e23d833 100644 Binary files a/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.dll and b/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.dll differ diff --git a/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.pdb b/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.pdb index 0d6b562..e9c8d6b 100644 Binary files a/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.pdb and b/Matrix App/obj/Debug/netcoreapp3.1/Matrix App.pdb differ diff --git a/Matrix App/obj/Debug/netcoreapp3.1/Matrix_App.Properties.Resources.resources b/Matrix App/obj/Debug/netcoreapp3.1/Matrix_App.Properties.Resources.resources index 7f4bf7b..54dc4a6 100644 Binary files a/Matrix App/obj/Debug/netcoreapp3.1/Matrix_App.Properties.Resources.resources and b/Matrix App/obj/Debug/netcoreapp3.1/Matrix_App.Properties.Resources.resources differ