diff --git a/CHANGELOG.md b/CHANGELOG.md index 37ef90a2..58c02104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 01/06/2020 - v0.4.1 - Beta + +* (Add) Opening, Closing and Gradient Mutators +* (Add) Choose layer range when appling a mutator #1 +* (Add) Choose iterations range/fading when appling a mutator (Thanks to Renos Makrosellis) +* (Add) Global and unhandled exceptions are now logged to be easier to report a bug +* (Change) Current layer and layer count text was reduced by 1 to match indexes on mutators +* (Improvement) Better mutator dialogs and explanation +* (Improvement) Compressed GUI images size +* (Fix) SlicerHeader was with wrong data size and affecting .photon, .cbddlp and .cbt (Thanks to Renos Makrosellis) + + ## 27/05/2020 - v0.4 - Beta * (Add) CWS file format diff --git a/PrusaSL1Reader/ChituboxFile.cs b/PrusaSL1Reader/ChituboxFile.cs index f671fe34..e4be6931 100644 --- a/PrusaSL1Reader/ChituboxFile.cs +++ b/PrusaSL1Reader/ChituboxFile.cs @@ -703,11 +703,9 @@ void rleRGB15() currentOffset += Helpers.SerializeWriteFileStream(outputFile, PrintParametersSettings); HeaderSettings.SlicerOffset = currentOffset; - HeaderSettings.SlicerSize = (uint) Helpers.Serializer.SizeOf(SlicerInfoSettings); + HeaderSettings.SlicerSize = (uint) Helpers.Serializer.SizeOf(SlicerInfoSettings) - SlicerInfoSettings.MachineNameSize; - SlicerInfoSettings.MachineNameAddress = - (uint) (currentOffset + Helpers.Serializer.SizeOf(SlicerInfoSettings) - - SlicerInfoSettings.MachineNameSize); + SlicerInfoSettings.MachineNameAddress = currentOffset + HeaderSettings.SlicerSize; currentOffset += Helpers.SerializeWriteFileStream(outputFile, SlicerInfoSettings); diff --git a/PrusaSL1Reader/PHZFile.cs b/PrusaSL1Reader/PHZFile.cs index 5d7371e1..c2f2ced7 100644 --- a/PrusaSL1Reader/PHZFile.cs +++ b/PrusaSL1Reader/PHZFile.cs @@ -715,6 +715,10 @@ void AddRep() for (int x = 0; x < image.Width; x++) { var grey7 = (byte)((pixelRowSpan[x].PackedValue >> 1) & 0x7f); + if (grey7 > 0x7c) + { + grey7 = 0x7c; + } if (color == byte.MaxValue) { @@ -882,6 +886,12 @@ private Image DecodePhzImage(uint layerIndex) //lastColor = (byte) (code << 1); // // Convert from 7bpp to 8bpp (extending the last bit) lastColor = (byte) (((code & 0x7f) << 1) | (code & 1)); + if (lastColor >= 0xfc) { + // Make 'white' actually white + lastColor = 0xff; + + } + if (index < limit) { span[index].PackedValue = lastColor; diff --git a/PrusaSL1Reader/PrusaSL1Reader.csproj b/PrusaSL1Reader/PrusaSL1Reader.csproj index 92d9c60c..2682295e 100644 --- a/PrusaSL1Reader/PrusaSL1Reader.csproj +++ b/PrusaSL1Reader/PrusaSL1Reader.csproj @@ -7,9 +7,9 @@ https://github.com/sn4k3/PrusaSL1Viewer https://github.com/sn4k3/PrusaSL1Viewer - 0.4.0.0 - 0.4.4.0 - 0.4 + 0.4.1.0 + 0.4.1.0 + 0.4.1 Open, view, edit, extract and convert DLP/SLA files generated from Slicers diff --git a/PrusaSL1Viewer/Controls/SplitButton.cs b/PrusaSL1Viewer/Controls/SplitButton.cs new file mode 100644 index 00000000..57140e43 --- /dev/null +++ b/PrusaSL1Viewer/Controls/SplitButton.cs @@ -0,0 +1,99 @@ +/* + * GNU AFFERO GENERAL PUBLIC LICENSE + * Version 3, 19 November 2007 + * Copyright (C) 2007 Free Software Foundation, Inc. + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. + */ +// https://stackoverflow.com/questions/10803184/windows-forms-button-with-drop-down-menu +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace PrusaSL1Viewer.Controls +{ + public class SplitButton : Button + { + [DefaultValue(null), Browsable(true), + DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] + public ContextMenuStrip Menu { get; set; } + + [DefaultValue(20), Browsable(true), + DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] + public int SplitWidth { get; set; } = 20; + + [DefaultValue(false), Browsable(true), + DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] + public bool OpenMenuOnlyOnArrow { get; set; } = false; + + public SplitButton() + { + } + + protected override void OnMouseClick(MouseEventArgs e) + { + if (Menu != null && e.Button == MouseButtons.Left) + { + if (OpenMenuOnlyOnArrow) + { + var splitRect = new Rectangle(this.Width - this.SplitWidth, 0, this.SplitWidth, this.Height); + if (!splitRect.Contains(e.Location)) + { + base.OnMouseDown(e); + return; + } + } + Menu.Show(this, 0, this.Height); // Shows menu under button + //Menu.Show(this, mevent.Location); // Shows menu at click location + } + else + { + base.OnMouseDown(e); + } + } + + /*protected override void OnMouseDown(MouseEventArgs mevent) + { + var splitRect = new Rectangle(this.Width - this.SplitWidth, 0, this.SplitWidth, this.Height); + + // Figure out if the button click was on the button itself or the menu split + if (Menu != null && + mevent.Button == MouseButtons.Left && + splitRect.Contains(mevent.Location)) + { + Menu.Show(this, 0, this.Height); // Shows menu under button + //Menu.Show(this, mevent.Location); // Shows menu at click location + } + else + { + base.OnMouseDown(mevent); + } + }*/ + + protected override void OnPaint(PaintEventArgs pevent) + { + base.OnPaint(pevent); + + if (this.Menu != null && this.SplitWidth > 0) + { + // Draw the arrow glyph on the right side of the button + int arrowX = ClientRectangle.Width - 14; + int arrowY = ClientRectangle.Height / 2 - 1; + + var arrowBrush = Enabled ? SystemBrushes.ControlText : SystemBrushes.ButtonShadow; + var arrows = new[] { new Point(arrowX, arrowY), new Point(arrowX + 7, arrowY), new Point(arrowX + 3, arrowY + 4) }; + pevent.Graphics.FillPolygon(arrowBrush, arrows); + + // Draw a dashed separator on the left of the arrow + int lineX = ClientRectangle.Width - this.SplitWidth; + int lineYFrom = arrowY - 4; + int lineYTo = arrowY + 8; + using (var separatorPen = new Pen(Brushes.DarkGray) { DashStyle = DashStyle.Dot }) + { + pevent.Graphics.DrawLine(separatorPen, lineX, lineYFrom, lineX, lineYTo); + } + } + } + } +} diff --git a/PrusaSL1Viewer/FrmMain.cs b/PrusaSL1Viewer/FrmMain.cs index d5a965ff..a4126af1 100644 --- a/PrusaSL1Viewer/FrmMain.cs +++ b/PrusaSL1Viewer/FrmMain.cs @@ -14,6 +14,8 @@ using System.Reflection; using System.Threading.Tasks; using System.Windows.Forms; +using Emgu.CV; +using Emgu.CV.CvEnum; using Emgu.CV.Structure; using PrusaSL1Reader; using SixLabors.ImageSharp; @@ -22,37 +24,66 @@ using SixLabors.ImageSharp.Processing; using Color = System.Drawing.Color; using Point = System.Drawing.Point; +using Size = System.Drawing.Size; namespace PrusaSL1Viewer { public partial class FrmMain : Form { #region Enums - public enum eMutate - { - Erode, - Dilate, - PyrDownUp, - SmoothMedian, - SmoothGaussian - } #endregion #region Properties - public static readonly Dictionary MutateDescriptions = new Dictionary - { - {eMutate.Erode, "Erodes image using a 3x3 rectangular structuring element.\n" + - "Erosion are applied several (iterations) times"}, - {eMutate.Dilate, "Dilates image using a 3x3 rectangular structuring element.\n" + - "Dilation are applied several (iterations) times"}, - {eMutate.PyrDownUp, "Performs downsampling step of Gaussian pyramid decomposition.\n" + - "First it convolves image with the specified filter and then downsamples the image by rejecting even rows and columns.\n" + - "After performs up-sampling step of Gaussian pyramid decomposition\n" + - "First it upsamples image by injecting even zero rows and columns and then convolves result with the specified filter multiplied by 4 for interpolation"}, - {eMutate.SmoothMedian, "Finding median of size neighborhood"}, - {eMutate.SmoothGaussian, "Perform Gaussian Smoothing"} - }; + public static readonly Dictionary Mutations = + new Dictionary + { + {Mutation.Mutates.Erode, new Mutation(Mutation.Mutates.Erode, + "The basic idea of erosion is just like soil erosion only, it erodes away the boundaries of foreground object (Always try to keep foreground in white). " + + "So what happends is that, all the pixels near boundary will be discarded depending upon the size of kernel. So the thickness or size of the foreground object decreases or simply white region decreases in the image. It is useful for removing small white noises, detach two connected objects, etc.", + Properties.Resources.mutation_erosion + )}, + {Mutation.Mutates.Dilate, new Mutation(Mutation.Mutates.Dilate, + "It is just opposite of erosion. Here, a pixel element is '1' if atleast one pixel under the kernel is '1'. So it increases the white region in the image or size of foreground object increases. Normally, in cases like noise removal, erosion is followed by dilation. Because, erosion removes white noises, but it also shrinks our object. So we dilate it. Since noise is gone, they won't come back, but our object area increases. It is also useful in joining broken parts of an object.", + Properties.Resources.mutation_dilation + )}, + {Mutation.Mutates.Opening, new Mutation(Mutation.Mutates.Opening, + "Opening is just another name of erosion followed by dilation. It is useful in removing noise.", + Properties.Resources.mutation_opening + )}, + {Mutation.Mutates.Closing, new Mutation(Mutation.Mutates.Closing, + "Closing is reverse of Opening, Dilation followed by Erosion. It is useful in closing small holes inside the foreground objects, or small black points on the object.", + Properties.Resources.mutation_closing + )}, + {Mutation.Mutates.Gradient, new Mutation(Mutation.Mutates.Gradient, + "It's the difference between dilation and erosion of an image.", + Properties.Resources.mutation_gradient + )}, + /*{Mutation.Mutates.TopHat, new Mutation(Mutation.Mutates.TopHat, + "It's the difference between input image and Opening of the image.", + Properties.Resources.mutation_tophat + )}, + {Mutation.Mutates.BlackHat, new Mutation(Mutation.Mutates.BlackHat, + "It's the difference between the closing of the input image and input image.", + Properties.Resources.mutation_blackhat + )},*/ + /*{Mutation.Mutates.HitMiss, new Mutation(Mutation.Mutates.HitMiss, + "The Hit-or-Miss transformation is useful to find patterns in binary images. In particular, it finds those pixels whose neighbourhood matches the shape of a first structuring element B1 while not matching the shape of a second structuring element B2 at the same time.", + null + )},*/ + {Mutation.Mutates.PyrDownUp, new Mutation(Mutation.Mutates.PyrDownUp, + "Performs downsampling step of Gaussian pyramid decomposition.\n" + + "First it convolves image with the specified filter and then downsamples the image by rejecting even rows and columns.\n" + + "After performs up-sampling step of Gaussian pyramid decomposition\n" + )}, + {Mutation.Mutates.SmoothMedian, new Mutation(Mutation.Mutates.SmoothMedian, + "Finding median of size neighborhood" + )}, + {Mutation.Mutates.SmoothGaussian, new Mutation(Mutation.Mutates.SmoothGaussian, + "Perform Gaussian Smoothing" + )}, + }; + public FrmLoading FrmLoading { get; } public static FileFormat SlicerFile @@ -79,11 +110,12 @@ public FrmMain() DragEnter += (s, e) => { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; }; DragDrop += (s, e) => { ProcessFile((string[])e.Data.GetData(DataFormats.FileDrop)); }; - foreach (eMutate mutate in (eMutate[])Enum.GetValues(typeof(eMutate))) + foreach (Mutation.Mutates mutate in (Mutation.Mutates[])Enum.GetValues(typeof(Mutation.Mutates))) { + if(!Mutations.ContainsKey(mutate)) continue; var item = new ToolStripMenuItem(mutate.ToString()) { - ToolTipText = MutateDescriptions[mutate], Tag = mutate, AutoToolTip = true + ToolTipText = Mutations[mutate].Description, Tag = mutate, AutoToolTip = true, Image = Properties.Resources.filter_filled_16x16 }; item.Click += ItemClicked; menuMutate.DropDownItems.Add(item); @@ -374,9 +406,9 @@ private void ItemClicked(object sender, EventArgs e) } - if (item.Tag.GetType() == typeof(eMutate)) + if (item.Tag.GetType() == typeof(Mutation.Mutates)) { - eMutate mutate = (eMutate)item.Tag; + Mutation.Mutates mutate = (Mutation.Mutates)item.Tag; MutateLayers(mutate); return; } @@ -1128,7 +1160,7 @@ void ShowLayer(uint layerNum) watch.Stop(); tsLayerPreviewTime.Text = $"{watch.ElapsedMilliseconds}ms"; - lbLayers.Text = $"{SlicerFile.GetHeightFromLayer((uint)layerNum + 1)} / {SlicerFile.TotalHeight}mm\n{layerNum + 1} / {SlicerFile.LayerCount}\n{percent}%"; + lbLayers.Text = $"{SlicerFile.GetHeightFromLayer((uint)layerNum + 1)} / {SlicerFile.TotalHeight}mm\n{layerNum} / {SlicerFile.LayerCount-1}\n{percent}%"; pbLayers.Value = percent; } catch (Exception e) @@ -1229,14 +1261,29 @@ private void pbLayer_MouseMove(object sender, MouseEventArgs e) DrawPixel(true, e.Location, Color.Green, Helpers.L8White); } - public void MutateLayers(eMutate type) + public void MutateLayers(Mutation.Mutates type) { - decimal value = 0; - using (FrmInputBox inputBox = new FrmInputBox($"Mutate - {type}", MutateDescriptions[type], 0)) + uint layerStart; + uint layerEnd; + uint iterationsStart; + uint iterationsEnd; + bool fade; + float iterationSteps = 0; + uint maxIteration = 0; + using (FrmMutation inputBox = new FrmMutation(Mutations[type])) { if (inputBox.ShowDialog() != DialogResult.OK) return; - value = inputBox.NewValue; - if (value == 0) return; + iterationsStart = inputBox.Iterations; + if (iterationsStart == 0) return; + layerStart = inputBox.LayerRangeStart; + layerEnd = inputBox.LayerRangeEnd; + iterationsEnd = inputBox.IterationsEnd; + fade = layerStart != layerEnd && iterationsStart != iterationsEnd && inputBox.IterationsFade; + if (fade) + { + iterationSteps = Math.Abs((float)iterationsStart - iterationsEnd) / (layerEnd - layerStart); + maxIteration = Math.Max(iterationsStart, iterationsEnd); + } } DisableGUI(); @@ -1247,26 +1294,63 @@ public void MutateLayers(eMutate type) bool result = false; try { - Parallel.ForEach(SlicerFile, (layer) => + Parallel.For(layerStart, layerEnd+1, i => { + var iterations = iterationsStart; + if (fade) + { + // calculate iterations based on range + iterations = iterationsStart < iterationsEnd ? + (uint) ((i + 1 - layerStart) * iterationSteps) : + (uint) (iterationsStart - (i - layerStart) * iterationSteps); + + // constrain + iterations = Math.Min(Math.Max(1, iterations), maxIteration); + //Debug.WriteLine($"A Layer: {i} = {iterations}"); + } + LayerManager.Layer layer = SlicerFile[i]; var image = layer.Image; var imageEgmu = image.ToEmguImage(); switch (type) { - case eMutate.Erode: - imageEgmu = imageEgmu.Erode((int) value); + case Mutation.Mutates.Erode: + imageEgmu = imageEgmu.Erode((int) iterations); + break; + case Mutation.Mutates.Dilate: + imageEgmu = imageEgmu.Dilate((int) iterations); + break; + case Mutation.Mutates.Opening: + imageEgmu = imageEgmu.Erode((int)iterations); + imageEgmu = imageEgmu.Dilate((int)iterations); + break; + case Mutation.Mutates.Closing: + imageEgmu = imageEgmu.Dilate((int)iterations); + imageEgmu = imageEgmu.Erode((int)iterations); + break; + case Mutation.Mutates.Gradient: + imageEgmu = imageEgmu.MorphologyEx(MorphOp.Gradient, Program.KernelStar3x3, new Point(-1, -1), (int) iterations, + BorderType.Default, new MCvScalar()); + break; + case Mutation.Mutates.TopHat: + imageEgmu = imageEgmu.MorphologyEx(MorphOp.Tophat, CvInvoke.GetStructuringElement(ElementShape.Rectangle, new Size(9, 9), new Point(-1, -1)), new Point(-1, -1), (int)iterations, + BorderType.Default, new MCvScalar()); + break; + case Mutation.Mutates.BlackHat: + imageEgmu = imageEgmu.MorphologyEx(MorphOp.Blackhat, CvInvoke.GetStructuringElement(ElementShape.Rectangle, new Size(9, 9), new Point(-1, -1)), new Point(-1, -1), (int)iterations, + BorderType.Default, new MCvScalar()); break; - case eMutate.Dilate: - imageEgmu = imageEgmu.Dilate((int) value); + case Mutation.Mutates.HitMiss: + imageEgmu = imageEgmu.MorphologyEx(MorphOp.HitMiss, Program.KernelFindIsolated, new Point(-1, -1), (int)iterations, + BorderType.Default, new MCvScalar()); break; - case eMutate.PyrDownUp: + case Mutation.Mutates.PyrDownUp: imageEgmu = imageEgmu.PyrDown().PyrUp(); break; - case eMutate.SmoothMedian: - imageEgmu = imageEgmu.SmoothMedian((int) value); + case Mutation.Mutates.SmoothMedian: + imageEgmu = imageEgmu.SmoothMedian((int) iterations); break; - case eMutate.SmoothGaussian: - imageEgmu = imageEgmu.SmoothGaussian((int)value); + case Mutation.Mutates.SmoothGaussian: + imageEgmu = imageEgmu.SmoothGaussian((int)iterations); break; } layer.Image = imageEgmu.ToImageSharpL8(); diff --git a/PrusaSL1Viewer/FrmMain.resx b/PrusaSL1Viewer/FrmMain.resx index ece3314a..4d21ad4b 100644 --- a/PrusaSL1Viewer/FrmMain.resx +++ b/PrusaSL1Viewer/FrmMain.resx @@ -126,12 +126,6 @@ 201, 17 - - 291, 17 - - - 649, 17 - 551, 17 @@ -143,37 +137,37 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E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AYABAQL/AgAL + + 291, 17 + + + 649, 17 + + + 551, 17 + diff --git a/PrusaSL1Viewer/FrmMutation.Designer.cs b/PrusaSL1Viewer/FrmMutation.Designer.cs new file mode 100644 index 00000000..80776ecd --- /dev/null +++ b/PrusaSL1Viewer/FrmMutation.Designer.cs @@ -0,0 +1,380 @@ +namespace PrusaSL1Viewer +{ + partial class FrmMutation + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMutation)); + this.lbDescription = new System.Windows.Forms.Label(); + this.lbIterationsStart = new System.Windows.Forms.Label(); + this.numIterationsStart = new System.Windows.Forms.NumericUpDown(); + this.lbLayerRange = new System.Windows.Forms.Label(); + this.nmLayerRangeStart = new System.Windows.Forms.NumericUpDown(); + this.nmLayerRangeEnd = new System.Windows.Forms.NumericUpDown(); + this.lbLayerRangeTo = new System.Windows.Forms.Label(); + this.cmLayerRange = new System.Windows.Forms.ContextMenuStrip(this.components); + this.btnLayerRangeAllLayers = new System.Windows.Forms.ToolStripMenuItem(); + this.btnLayerRangeCurrentLayer = new System.Windows.Forms.ToolStripMenuItem(); + this.btnLayerRangeBottomLayers = new System.Windows.Forms.ToolStripMenuItem(); + this.btnLayerRangeNormalLayers = new System.Windows.Forms.ToolStripMenuItem(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnPreview = new System.Windows.Forms.Button(); + this.pbInfo = new System.Windows.Forms.PictureBox(); + this.btnMutate = new System.Windows.Forms.Button(); + this.lbIterationsStop = new System.Windows.Forms.Label(); + this.nmIterationsEnd = new System.Windows.Forms.NumericUpDown(); + this.cbIterationsFade = new System.Windows.Forms.CheckBox(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.btnLayerRangeSelect = new PrusaSL1Viewer.Controls.SplitButton(); + ((System.ComponentModel.ISupportInitialize)(this.numIterationsStart)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeStart)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeEnd)).BeginInit(); + this.cmLayerRange.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbInfo)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nmIterationsEnd)).BeginInit(); + this.SuspendLayout(); + // + // lbDescription + // + this.lbDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.lbDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbDescription.Location = new System.Drawing.Point(13, 14); + this.lbDescription.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbDescription.Name = "lbDescription"; + this.lbDescription.Size = new System.Drawing.Size(584, 128); + this.lbDescription.TabIndex = 0; + this.lbDescription.Text = "Description"; + // + // lbIterationsStart + // + this.lbIterationsStart.AutoSize = true; + this.lbIterationsStart.Location = new System.Drawing.Point(13, 190); + this.lbIterationsStart.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbIterationsStart.Name = "lbIterationsStart"; + this.lbIterationsStart.Size = new System.Drawing.Size(80, 20); + this.lbIterationsStart.TabIndex = 3; + this.lbIterationsStart.Text = "Iterations:"; + this.toolTip.SetToolTip(this.lbIterationsStart, resources.GetString("lbIterationsStart.ToolTip")); + // + // numIterationsStart + // + this.numIterationsStart.Location = new System.Drawing.Point(132, 187); + this.numIterationsStart.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.numIterationsStart.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numIterationsStart.Name = "numIterationsStart"; + this.numIterationsStart.Size = new System.Drawing.Size(149, 26); + this.numIterationsStart.TabIndex = 3; + this.numIterationsStart.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // lbLayerRange + // + this.lbLayerRange.AutoSize = true; + this.lbLayerRange.Location = new System.Drawing.Point(13, 150); + this.lbLayerRange.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbLayerRange.Name = "lbLayerRange"; + this.lbLayerRange.Size = new System.Drawing.Size(97, 20); + this.lbLayerRange.TabIndex = 9; + this.lbLayerRange.Text = "Layer range:"; + this.toolTip.SetToolTip(this.lbLayerRange, resources.GetString("lbLayerRange.ToolTip")); + // + // nmLayerRangeStart + // + this.nmLayerRangeStart.Location = new System.Drawing.Point(132, 147); + this.nmLayerRangeStart.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.nmLayerRangeStart.Maximum = new decimal(new int[] { + 100000, + 0, + 0, + 0}); + this.nmLayerRangeStart.Name = "nmLayerRangeStart"; + this.nmLayerRangeStart.Size = new System.Drawing.Size(149, 26); + this.nmLayerRangeStart.TabIndex = 0; + // + // nmLayerRangeEnd + // + this.nmLayerRangeEnd.Location = new System.Drawing.Point(328, 147); + this.nmLayerRangeEnd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.nmLayerRangeEnd.Maximum = new decimal(new int[] { + 100000, + 0, + 0, + 0}); + this.nmLayerRangeEnd.Name = "nmLayerRangeEnd"; + this.nmLayerRangeEnd.Size = new System.Drawing.Size(149, 26); + this.nmLayerRangeEnd.TabIndex = 1; + // + // lbLayerRangeTo + // + this.lbLayerRangeTo.AutoSize = true; + this.lbLayerRangeTo.Location = new System.Drawing.Point(289, 150); + this.lbLayerRangeTo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbLayerRangeTo.Name = "lbLayerRangeTo"; + this.lbLayerRangeTo.Size = new System.Drawing.Size(31, 20); + this.lbLayerRangeTo.TabIndex = 12; + this.lbLayerRangeTo.Text = "To:"; + // + // cmLayerRange + // + this.cmLayerRange.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.btnLayerRangeAllLayers, + this.btnLayerRangeCurrentLayer, + this.btnLayerRangeBottomLayers, + this.btnLayerRangeNormalLayers}); + this.cmLayerRange.Name = "cmLayerRange"; + this.cmLayerRange.Size = new System.Drawing.Size(226, 92); + // + // btnLayerRangeAllLayers + // + this.btnLayerRangeAllLayers.Name = "btnLayerRangeAllLayers"; + this.btnLayerRangeAllLayers.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.A))); + this.btnLayerRangeAllLayers.Size = new System.Drawing.Size(225, 22); + this.btnLayerRangeAllLayers.Text = "&All Layers"; + this.btnLayerRangeAllLayers.Click += new System.EventHandler(this.ItemClicked); + // + // btnLayerRangeCurrentLayer + // + this.btnLayerRangeCurrentLayer.Name = "btnLayerRangeCurrentLayer"; + this.btnLayerRangeCurrentLayer.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.C))); + this.btnLayerRangeCurrentLayer.Size = new System.Drawing.Size(225, 22); + this.btnLayerRangeCurrentLayer.Text = "&Current Layer"; + this.btnLayerRangeCurrentLayer.Click += new System.EventHandler(this.ItemClicked); + // + // btnLayerRangeBottomLayers + // + this.btnLayerRangeBottomLayers.Name = "btnLayerRangeBottomLayers"; + this.btnLayerRangeBottomLayers.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.B))); + this.btnLayerRangeBottomLayers.Size = new System.Drawing.Size(225, 22); + this.btnLayerRangeBottomLayers.Text = "&Bottom Layers"; + this.btnLayerRangeBottomLayers.Click += new System.EventHandler(this.ItemClicked); + // + // btnLayerRangeNormalLayers + // + this.btnLayerRangeNormalLayers.Name = "btnLayerRangeNormalLayers"; + this.btnLayerRangeNormalLayers.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.N))); + this.btnLayerRangeNormalLayers.Size = new System.Drawing.Size(225, 22); + this.btnLayerRangeNormalLayers.Text = "&Normal Layers"; + this.btnLayerRangeNormalLayers.Click += new System.EventHandler(this.ItemClicked); + // + // btnCancel + // + this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Image = global::PrusaSL1Viewer.Properties.Resources.Cancel_24x24; + this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.btnCancel.Location = new System.Drawing.Point(447, 230); + this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(150, 48); + this.btnCancel.TabIndex = 6; + this.btnCancel.Text = "&Cancel"; + this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.ItemClicked); + // + // btnPreview + // + this.btnPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnPreview.Enabled = false; + this.btnPreview.Image = global::PrusaSL1Viewer.Properties.Resources.eye_24x24; + this.btnPreview.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.btnPreview.Location = new System.Drawing.Point(131, 230); + this.btnPreview.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnPreview.Name = "btnPreview"; + this.btnPreview.Size = new System.Drawing.Size(150, 48); + this.btnPreview.TabIndex = 4; + this.btnPreview.Text = "&Preview"; + this.btnPreview.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.btnPreview.UseVisualStyleBackColor = true; + // + // pbInfo + // + this.pbInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.pbInfo.Location = new System.Drawing.Point(604, 14); + this.pbInfo.Name = "pbInfo"; + this.pbInfo.Size = new System.Drawing.Size(311, 264); + this.pbInfo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pbInfo.TabIndex = 7; + this.pbInfo.TabStop = false; + this.pbInfo.Visible = false; + // + // btnMutate + // + this.btnMutate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnMutate.Image = global::PrusaSL1Viewer.Properties.Resources.Ok_24x24; + this.btnMutate.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.btnMutate.Location = new System.Drawing.Point(289, 230); + this.btnMutate.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnMutate.Name = "btnMutate"; + this.btnMutate.Size = new System.Drawing.Size(150, 48); + this.btnMutate.TabIndex = 5; + this.btnMutate.Text = "&Mutate"; + this.btnMutate.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.btnMutate.UseVisualStyleBackColor = true; + this.btnMutate.Click += new System.EventHandler(this.ItemClicked); + // + // lbIterationsStop + // + this.lbIterationsStop.AutoSize = true; + this.lbIterationsStop.Enabled = false; + this.lbIterationsStop.Location = new System.Drawing.Point(289, 190); + this.lbIterationsStop.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbIterationsStop.Name = "lbIterationsStop"; + this.lbIterationsStop.Size = new System.Drawing.Size(31, 20); + this.lbIterationsStop.TabIndex = 13; + this.lbIterationsStop.Text = "To:"; + // + // nmIterationsEnd + // + this.nmIterationsEnd.Enabled = false; + this.nmIterationsEnd.Location = new System.Drawing.Point(328, 187); + this.nmIterationsEnd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.nmIterationsEnd.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nmIterationsEnd.Name = "nmIterationsEnd"; + this.nmIterationsEnd.Size = new System.Drawing.Size(149, 26); + this.nmIterationsEnd.TabIndex = 14; + this.nmIterationsEnd.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // cbIterationsFade + // + this.cbIterationsFade.AutoSize = true; + this.cbIterationsFade.Location = new System.Drawing.Point(484, 188); + this.cbIterationsFade.Name = "cbIterationsFade"; + this.cbIterationsFade.Size = new System.Drawing.Size(108, 24); + this.cbIterationsFade.TabIndex = 15; + this.cbIterationsFade.Text = "Fade in/out"; + this.cbIterationsFade.UseVisualStyleBackColor = true; + this.cbIterationsFade.CheckedChanged += new System.EventHandler(this.CheckedChanged); + // + // toolTip + // + this.toolTip.AutoPopDelay = 32767; + this.toolTip.InitialDelay = 500; + this.toolTip.IsBalloon = true; + this.toolTip.ReshowDelay = 100; + this.toolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; + this.toolTip.ToolTipTitle = "Information"; + // + // btnLayerRangeSelect + // + this.btnLayerRangeSelect.Location = new System.Drawing.Point(484, 147); + this.btnLayerRangeSelect.Menu = this.cmLayerRange; + this.btnLayerRangeSelect.Name = "btnLayerRangeSelect"; + this.btnLayerRangeSelect.Size = new System.Drawing.Size(114, 26); + this.btnLayerRangeSelect.TabIndex = 2; + this.btnLayerRangeSelect.Text = "Select"; + this.btnLayerRangeSelect.UseVisualStyleBackColor = true; + // + // FrmMutation + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(927, 292); + this.Controls.Add(this.cbIterationsFade); + this.Controls.Add(this.nmIterationsEnd); + this.Controls.Add(this.lbIterationsStop); + this.Controls.Add(this.btnLayerRangeSelect); + this.Controls.Add(this.lbLayerRangeTo); + this.Controls.Add(this.nmLayerRangeEnd); + this.Controls.Add(this.nmLayerRangeStart); + this.Controls.Add(this.lbLayerRange); + this.Controls.Add(this.btnPreview); + this.Controls.Add(this.pbInfo); + this.Controls.Add(this.btnMutate); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.numIterationsStart); + this.Controls.Add(this.lbIterationsStart); + this.Controls.Add(this.lbDescription); + this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.KeyPreview = true; + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FrmMutation"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Form1"; + this.TopMost = true; + ((System.ComponentModel.ISupportInitialize)(this.numIterationsStart)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeStart)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeEnd)).EndInit(); + this.cmLayerRange.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pbInfo)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nmIterationsEnd)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbDescription; + private System.Windows.Forms.Label lbIterationsStart; + private System.Windows.Forms.NumericUpDown numIterationsStart; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnMutate; + private System.Windows.Forms.PictureBox pbInfo; + private System.Windows.Forms.Button btnPreview; + private System.Windows.Forms.Label lbLayerRange; + private System.Windows.Forms.NumericUpDown nmLayerRangeStart; + private System.Windows.Forms.NumericUpDown nmLayerRangeEnd; + private System.Windows.Forms.Label lbLayerRangeTo; + private Controls.SplitButton btnLayerRangeSelect; + private System.Windows.Forms.ContextMenuStrip cmLayerRange; + private System.Windows.Forms.ToolStripMenuItem btnLayerRangeAllLayers; + private System.Windows.Forms.ToolStripMenuItem btnLayerRangeCurrentLayer; + private System.Windows.Forms.ToolStripMenuItem btnLayerRangeBottomLayers; + private System.Windows.Forms.ToolStripMenuItem btnLayerRangeNormalLayers; + private System.Windows.Forms.Label lbIterationsStop; + private System.Windows.Forms.NumericUpDown nmIterationsEnd; + private System.Windows.Forms.CheckBox cbIterationsFade; + private System.Windows.Forms.ToolTip toolTip; + } +} \ No newline at end of file diff --git a/PrusaSL1Viewer/FrmMutation.cs b/PrusaSL1Viewer/FrmMutation.cs new file mode 100644 index 00000000..bbadb3b1 --- /dev/null +++ b/PrusaSL1Viewer/FrmMutation.cs @@ -0,0 +1,211 @@ +/* + * GNU AFFERO GENERAL PUBLIC LICENSE + * Version 3, 19 November 2007 + * Copyright (C) 2007 Free Software Foundation, Inc. + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. + */ +using System; +using System.Windows.Forms; + +namespace PrusaSL1Viewer +{ + public partial class FrmMutation : Form + { + #region Properties + + private Mutation Mutation { get; } + + public uint LayerRangeStart + { + get => (uint) nmLayerRangeStart.Value; + set => nmLayerRangeStart.Value = value; + } + + public uint LayerRangeEnd + { + get => (uint)Math.Min(nmLayerRangeEnd.Value, Program.SlicerFile.LayerCount-1); + set => nmLayerRangeEnd.Value = value; + } + + public uint Iterations + { + get => (uint) numIterationsStart.Value; + set => numIterationsStart.Value = value; + } + + public uint IterationsEnd + { + get => (uint)nmIterationsEnd.Value; + set => nmIterationsEnd.Value = value; + } + + public bool IterationsFade + { + get => cbIterationsFade.Checked; + set => cbIterationsFade.Checked = value; + } + #endregion + + #region Constructors + public FrmMutation(Mutation mutation, uint defaultIterations = 1) + { + InitializeComponent(); + Mutation = mutation; + DialogResult = DialogResult.Cancel; + + if (defaultIterations == 0 || mutation.Mutate == Mutation.Mutates.PyrDownUp) + { + lbIterationsStart.Enabled = + numIterationsStart.Enabled = + lbIterationsStop.Enabled = + nmIterationsEnd.Enabled = + cbIterationsFade.Enabled = + false; + } + else + { + Iterations = defaultIterations; + numIterationsStart.Select(); + } + + Text = $"Mutate: {mutation.Mutate}"; + lbDescription.Text = Mutation.Description; + + if (ReferenceEquals(mutation.Image, null)) + { + Width = pbInfo.Location.X+25; + } + else + { + pbInfo.Image = mutation.Image; + pbInfo.Visible = true; + } + + nmLayerRangeEnd.Value = Program.SlicerFile.LayerCount-1; + + } + #endregion + + #region Overrides + protected override void OnKeyUp(KeyEventArgs e) + { + base.OnKeyUp(e); + if (e.KeyCode == Keys.Enter) + { + btnMutate.PerformClick(); + e.Handled = true; + return; + } + + if ((ModifierKeys & Keys.Shift) == Keys.Shift && (ModifierKeys & Keys.Control) == Keys.Control) + { + if (e.KeyCode == Keys.A) + { + btnLayerRangeAllLayers.PerformClick(); + e.Handled = true; + return; + } + + if (e.KeyCode == Keys.C) + { + btnLayerRangeCurrentLayer.PerformClick(); + e.Handled = true; + return; + } + + if (e.KeyCode == Keys.B) + { + btnLayerRangeBottomLayers.PerformClick(); + e.Handled = true; + return; + } + + if (e.KeyCode == Keys.N) + { + btnLayerRangeNormalLayers.PerformClick(); + e.Handled = true; + return; + } + } + } + + #endregion + + #region Events + private void ItemClicked(object sender, EventArgs e) + { + if (ReferenceEquals(sender, btnLayerRangeAllLayers)) + { + nmLayerRangeStart.Value = 0; + nmLayerRangeEnd.Value = Program.SlicerFile.LayerCount-1; + return; + } + + if (ReferenceEquals(sender, btnLayerRangeCurrentLayer)) + { + nmLayerRangeStart.Value = Program.FrmMain.ActualLayer; + nmLayerRangeEnd.Value = Program.FrmMain.ActualLayer; + return; + } + + if (ReferenceEquals(sender, btnLayerRangeBottomLayers)) + { + nmLayerRangeStart.Value = 0; + nmLayerRangeEnd.Value = Program.SlicerFile.InitialLayerCount-1; + return; + } + + if (ReferenceEquals(sender, btnLayerRangeNormalLayers)) + { + nmLayerRangeStart.Value = Program.SlicerFile.InitialLayerCount - 1; + nmLayerRangeEnd.Value = Program.SlicerFile.LayerCount - 1; + return; + } + + if (ReferenceEquals(sender, btnMutate)) + { + if (!btnMutate.Enabled) return; + if (LayerRangeStart > LayerRangeEnd) + { + MessageBox.Show("Layer range start can't be higher than layer end.\nPlease fix and try again.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); + nmLayerRangeStart.Select(); + return; + } + if (MessageBox.Show($"Are you sure you want to {Mutation.Mutate}?", Text, MessageBoxButtons.YesNo, + MessageBoxIcon.Question) == DialogResult.Yes) + { + DialogResult = DialogResult.OK; + if (Iterations <= 0) // Should never happen! + { + DialogResult = DialogResult.Cancel; + } + Close(); + } + + return; + } + + if (ReferenceEquals(sender, btnCancel)) + { + DialogResult = DialogResult.Cancel; + return; + } + } + + private void CheckedChanged(object sender, EventArgs e) + { + if (ReferenceEquals(sender, cbIterationsFade)) + { + lbIterationsStop.Enabled = + nmIterationsEnd.Enabled = + cbIterationsFade.Checked; + + return; + } + } + #endregion + + + } +} diff --git a/PrusaSL1Viewer/ImageBox.resx b/PrusaSL1Viewer/FrmMutation.resx similarity index 83% rename from PrusaSL1Viewer/ImageBox.resx rename to PrusaSL1Viewer/FrmMutation.resx index 1af7de15..40776f48 100644 --- a/PrusaSL1Viewer/ImageBox.resx +++ b/PrusaSL1Viewer/FrmMutation.resx @@ -117,4 +117,20 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 148, 17 + + + Selects the number of iterations/passes to perform on each layer using this mutator. +Enable the "Fade in/out" to fade the iteration over layers, you can use a start iteration higher than end to perform a inverse fade. +WARNING: Using high iteration values can destroy your model depending on the mutator being used, please use low values or with caution! + + + Selects the layers range within start layer and end layer where mutator will operate. +Select same layer start as end to operate only within that layer. +Note: "Layer Start" start can't be higher than "Layer End". + + + 17, 17 + \ No newline at end of file diff --git a/PrusaSL1Viewer/ImageBox.Designer.cs b/PrusaSL1Viewer/ImageBox.Designer.cs deleted file mode 100644 index 9e71e8e4..00000000 --- a/PrusaSL1Viewer/ImageBox.Designer.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace PrusaSL1Viewer -{ - partial class ImageBox - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // ImageBox - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Black; - this.Name = "ImageBox"; - this.Size = new System.Drawing.Size(393, 251); - this.ResumeLayout(false); - - } - - #endregion - } -} diff --git a/PrusaSL1Viewer/ImageBox.cs b/PrusaSL1Viewer/ImageBox.cs deleted file mode 100644 index 985669b5..00000000 --- a/PrusaSL1Viewer/ImageBox.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.Advanced; -using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing; - -namespace PrusaSL1Viewer -{ - public partial class ImageBox : UserControl - { - private static SolidBrush Brush { get; } = new SolidBrush(System.Drawing.Color.White); - public Image Image { get; private set; } - - public ImageBox() - { - SetStyle(ControlStyles.UserPaint, true); - SetStyle(ControlStyles.AllPaintingInWmPaint, true); - SetStyle(ControlStyles.OptimizedDoubleBuffer, true); - SetStyle(ControlStyles.ResizeRedraw, true); - - UpdateStyles(); - InitializeComponent(); - - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - if (ReferenceEquals(Image, null)) return; - - var newImage = Image.Clone(); - - newImage.Mutate(x => x.Resize(Width, Height)); - - for (int y = 0; y < newImage.Height; y++) - { - var span = newImage.GetPixelRowSpan(y); - for (int x = 0; x < newImage.Width; x++) - { - if (span[x].PackedValue > 125) - e.Graphics.FillRectangle(Brush, x, y, 1, 1); - } - } - } - - public void SetImage(Image image) - { - Image = image; - - } - } -} diff --git a/PrusaSL1Viewer/Images/Back-16x16.png b/PrusaSL1Viewer/Images/Back-16x16.png index 1968f0d0..c28c6216 100644 Binary files a/PrusaSL1Viewer/Images/Back-16x16.png and b/PrusaSL1Viewer/Images/Back-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Button-Info-16x16.png b/PrusaSL1Viewer/Images/Button-Info-16x16.png index a9e49978..6b0d2959 100644 Binary files a/PrusaSL1Viewer/Images/Button-Info-16x16.png and b/PrusaSL1Viewer/Images/Button-Info-16x16.png differ diff --git a/PrusaSL1Viewer/Images/CNCMachine-16x16.png b/PrusaSL1Viewer/Images/CNCMachine-16x16.png index dbafe4d9..e2a5e4b3 100644 Binary files a/PrusaSL1Viewer/Images/CNCMachine-16x16.png and b/PrusaSL1Viewer/Images/CNCMachine-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Cancel-24x24.png b/PrusaSL1Viewer/Images/Cancel-24x24.png index b5a69201..74e45594 100644 Binary files a/PrusaSL1Viewer/Images/Cancel-24x24.png and b/PrusaSL1Viewer/Images/Cancel-24x24.png differ diff --git a/PrusaSL1Viewer/Images/Cancel-32x32.png b/PrusaSL1Viewer/Images/Cancel-32x32.png index 6c28da1b..a732caa2 100644 Binary files a/PrusaSL1Viewer/Images/Cancel-32x32.png and b/PrusaSL1Viewer/Images/Cancel-32x32.png differ diff --git a/PrusaSL1Viewer/Images/Convert-16x16.png b/PrusaSL1Viewer/Images/Convert-16x16.png index 75ea5696..76cf3c49 100644 Binary files a/PrusaSL1Viewer/Images/Convert-16x16.png and b/PrusaSL1Viewer/Images/Convert-16x16.png differ diff --git a/PrusaSL1Viewer/Images/DataList-16x16.png b/PrusaSL1Viewer/Images/DataList-16x16.png index b0e24de3..a4e784cd 100644 Binary files a/PrusaSL1Viewer/Images/DataList-16x16.png and b/PrusaSL1Viewer/Images/DataList-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Donate-16x16.png b/PrusaSL1Viewer/Images/Donate-16x16.png index 20d8f08f..8d9d6f1d 100644 Binary files a/PrusaSL1Viewer/Images/Donate-16x16.png and b/PrusaSL1Viewer/Images/Donate-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Error-128x128.png b/PrusaSL1Viewer/Images/Error-128x128.png index b26a92b2..d676c15f 100644 Binary files a/PrusaSL1Viewer/Images/Error-128x128.png and b/PrusaSL1Viewer/Images/Error-128x128.png differ diff --git a/PrusaSL1Viewer/Images/Exit-16x16.png b/PrusaSL1Viewer/Images/Exit-16x16.png index a111b846..863566c5 100644 Binary files a/PrusaSL1Viewer/Images/Exit-16x16.png and b/PrusaSL1Viewer/Images/Exit-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Extract-object-16x16.png b/PrusaSL1Viewer/Images/Extract-object-16x16.png index 1283fc3b..9bdb1d24 100644 Binary files a/PrusaSL1Viewer/Images/Extract-object-16x16.png and b/PrusaSL1Viewer/Images/Extract-object-16x16.png differ diff --git a/PrusaSL1Viewer/Images/File-Close-16x16.png b/PrusaSL1Viewer/Images/File-Close-16x16.png index 91440923..ef36711b 100644 Binary files a/PrusaSL1Viewer/Images/File-Close-16x16.png and b/PrusaSL1Viewer/Images/File-Close-16x16.png differ diff --git a/PrusaSL1Viewer/Images/File-Refresh-16x16.png b/PrusaSL1Viewer/Images/File-Refresh-16x16.png index 8407ab34..39d6920d 100644 Binary files a/PrusaSL1Viewer/Images/File-Refresh-16x16.png and b/PrusaSL1Viewer/Images/File-Refresh-16x16.png differ diff --git a/PrusaSL1Viewer/Images/GCode-16x16.png b/PrusaSL1Viewer/Images/GCode-16x16.png index c33c4a35..127cecc7 100644 Binary files a/PrusaSL1Viewer/Images/GCode-16x16.png and b/PrusaSL1Viewer/Images/GCode-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Geometry-16x16.png b/PrusaSL1Viewer/Images/Geometry-16x16.png index db04a865..da022c55 100644 Binary files a/PrusaSL1Viewer/Images/Geometry-16x16.png and b/PrusaSL1Viewer/Images/Geometry-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Global-Network-icon-16x16.png b/PrusaSL1Viewer/Images/Global-Network-icon-16x16.png index 971ded61..0c4e3be9 100644 Binary files a/PrusaSL1Viewer/Images/Global-Network-icon-16x16.png and b/PrusaSL1Viewer/Images/Global-Network-icon-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Next-16x16.png b/PrusaSL1Viewer/Images/Next-16x16.png index 15348a58..9d8f5e48 100644 Binary files a/PrusaSL1Viewer/Images/Next-16x16.png and b/PrusaSL1Viewer/Images/Next-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Ok-24x24.png b/PrusaSL1Viewer/Images/Ok-24x24.png index 1063d218..e4cc79d9 100644 Binary files a/PrusaSL1Viewer/Images/Ok-24x24.png and b/PrusaSL1Viewer/Images/Ok-24x24.png differ diff --git a/PrusaSL1Viewer/Images/Open-16x16.png b/PrusaSL1Viewer/Images/Open-16x16.png index 5117a1c6..40fcd9a8 100644 Binary files a/PrusaSL1Viewer/Images/Open-16x16.png and b/PrusaSL1Viewer/Images/Open-16x16.png differ diff --git a/PrusaSL1Viewer/Images/PhotoInfo-16x16.png b/PrusaSL1Viewer/Images/PhotoInfo-16x16.png index f5077ee5..f6a4c2fb 100644 Binary files a/PrusaSL1Viewer/Images/PhotoInfo-16x16.png and b/PrusaSL1Viewer/Images/PhotoInfo-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Rotate-16x16.png b/PrusaSL1Viewer/Images/Rotate-16x16.png index 9061e0f4..55f04c68 100644 Binary files a/PrusaSL1Viewer/Images/Rotate-16x16.png and b/PrusaSL1Viewer/Images/Rotate-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Save-16x16.png b/PrusaSL1Viewer/Images/Save-16x16.png index c3f3d127..38ce7592 100644 Binary files a/PrusaSL1Viewer/Images/Save-16x16.png and b/PrusaSL1Viewer/Images/Save-16x16.png differ diff --git a/PrusaSL1Viewer/Images/SaveAs-16x16.png b/PrusaSL1Viewer/Images/SaveAs-16x16.png index 33cf0078..e22cce71 100644 Binary files a/PrusaSL1Viewer/Images/SaveAs-16x16.png and b/PrusaSL1Viewer/Images/SaveAs-16x16.png differ diff --git a/PrusaSL1Viewer/Images/Wrench-16x16.png b/PrusaSL1Viewer/Images/Wrench-16x16.png index 7e3bae43..2838a764 100644 Binary files a/PrusaSL1Viewer/Images/Wrench-16x16.png and b/PrusaSL1Viewer/Images/Wrench-16x16.png differ diff --git a/PrusaSL1Viewer/Images/eye-16x16.png b/PrusaSL1Viewer/Images/eye-16x16.png new file mode 100644 index 00000000..4f3c7e2d Binary files /dev/null and b/PrusaSL1Viewer/Images/eye-16x16.png differ diff --git a/PrusaSL1Viewer/Images/eye-24x24.png b/PrusaSL1Viewer/Images/eye-24x24.png new file mode 100644 index 00000000..190959b4 Binary files /dev/null and b/PrusaSL1Viewer/Images/eye-24x24.png differ diff --git a/PrusaSL1Viewer/Images/filter-filled-16x16.png b/PrusaSL1Viewer/Images/filter-filled-16x16.png new file mode 100644 index 00000000..d0919226 Binary files /dev/null and b/PrusaSL1Viewer/Images/filter-filled-16x16.png differ diff --git a/PrusaSL1Viewer/Images/gui/mutation_blackhat.png b/PrusaSL1Viewer/Images/gui/mutation_blackhat.png new file mode 100644 index 00000000..80f1cd08 Binary files /dev/null and b/PrusaSL1Viewer/Images/gui/mutation_blackhat.png differ diff --git a/PrusaSL1Viewer/Images/gui/mutation_closing.png b/PrusaSL1Viewer/Images/gui/mutation_closing.png new file mode 100644 index 00000000..79e02c6a Binary files /dev/null and b/PrusaSL1Viewer/Images/gui/mutation_closing.png differ diff --git a/PrusaSL1Viewer/Images/gui/mutation_dilation.png b/PrusaSL1Viewer/Images/gui/mutation_dilation.png new file mode 100644 index 00000000..92e19524 Binary files /dev/null and b/PrusaSL1Viewer/Images/gui/mutation_dilation.png differ diff --git a/PrusaSL1Viewer/Images/gui/mutation_erosion.png b/PrusaSL1Viewer/Images/gui/mutation_erosion.png new file mode 100644 index 00000000..8f2422c7 Binary files /dev/null and b/PrusaSL1Viewer/Images/gui/mutation_erosion.png differ diff --git a/PrusaSL1Viewer/Images/gui/mutation_gradient.png b/PrusaSL1Viewer/Images/gui/mutation_gradient.png new file mode 100644 index 00000000..7b60d709 Binary files /dev/null and b/PrusaSL1Viewer/Images/gui/mutation_gradient.png differ diff --git a/PrusaSL1Viewer/Images/gui/mutation_opening.png b/PrusaSL1Viewer/Images/gui/mutation_opening.png new file mode 100644 index 00000000..6ddb9f55 Binary files /dev/null and b/PrusaSL1Viewer/Images/gui/mutation_opening.png differ diff --git a/PrusaSL1Viewer/Images/gui/mutation_tophat.png b/PrusaSL1Viewer/Images/gui/mutation_tophat.png new file mode 100644 index 00000000..60c1c84f Binary files /dev/null and b/PrusaSL1Viewer/Images/gui/mutation_tophat.png differ diff --git a/PrusaSL1Viewer/Images/layers-16x16.png b/PrusaSL1Viewer/Images/layers-16x16.png index efc9a32c..b8f66f51 100644 Binary files a/PrusaSL1Viewer/Images/layers-16x16.png and b/PrusaSL1Viewer/Images/layers-16x16.png differ diff --git a/PrusaSL1Viewer/Images/pixel-16x16.png b/PrusaSL1Viewer/Images/pixel-16x16.png index 74611c27..d7c46a76 100644 Binary files a/PrusaSL1Viewer/Images/pixel-16x16.png and b/PrusaSL1Viewer/Images/pixel-16x16.png differ diff --git a/PrusaSL1Viewer/Images/search-16x16.png b/PrusaSL1Viewer/Images/search-16x16.png index 99ae5d04..ea9d8e2b 100644 Binary files a/PrusaSL1Viewer/Images/search-16x16.png and b/PrusaSL1Viewer/Images/search-16x16.png differ diff --git a/PrusaSL1Viewer/Libraries/ApplicationManagement.dll b/PrusaSL1Viewer/Libraries/ApplicationManagement.dll new file mode 100644 index 00000000..3e7d7937 Binary files /dev/null and b/PrusaSL1Viewer/Libraries/ApplicationManagement.dll differ diff --git a/PrusaSL1Viewer/Mutation.cs b/PrusaSL1Viewer/Mutation.cs new file mode 100644 index 00000000..5e80e80b --- /dev/null +++ b/PrusaSL1Viewer/Mutation.cs @@ -0,0 +1,51 @@ +/* + * GNU AFFERO GENERAL PUBLIC LICENSE + * Version 3, 19 November 2007 + * Copyright (C) 2007 Free Software Foundation, Inc. + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. + */ +using System.Drawing; + + +namespace PrusaSL1Viewer +{ + public class Mutation + { + #region Enum + public enum Mutates : byte + { + Erode, + Dilate, + Opening, + Closing, + Gradient, + TopHat, + BlackHat, + HitMiss, + PyrDownUp, + SmoothMedian, + SmoothGaussian + } + #endregion + + #region Properties + public Mutates Mutate { get; } + + public string Description { get; } + + public Image Image { get; } + #endregion + + #region Constructor + + public Mutation(Mutates mutate, string description, Image image = null) + { + Mutate = mutate; + Description = description; + Image = image; + } + + #endregion + } +} diff --git a/PrusaSL1Viewer/Program.cs b/PrusaSL1Viewer/Program.cs index d8cf1b52..a26cecc8 100644 --- a/PrusaSL1Viewer/Program.cs +++ b/PrusaSL1Viewer/Program.cs @@ -11,6 +11,8 @@ using System.Globalization; using System.Threading; using System.Windows.Forms; +using ApplicationManagement; +using Emgu.CV; using PrusaSL1Reader; namespace PrusaSL1Viewer @@ -61,9 +63,26 @@ public static void SetAllControlsFontSize( }; } + public static Matrix KernelStar3x3 { get; } = new Matrix(new byte[,] + { + { 0, 1, 0 }, + { 1, 0, 1 }, + { 0, 1, 0 } + }); + + public static Matrix KernelFindIsolated { get; } = new Matrix(new sbyte[,] + { + { 0, 1, 0 }, + { 1, -1, 1 }, + { 0, 1, 0 } + }); + public static FileFormat SlicerFile { get; set; } public static FrmMain FrmMain { get; private set; } public static FrmAbout FrmAbout { get; private set; } + + public static ExceptionHandler ExceptionHandler { get; private set; } + public static string[] Args { get; private set; } /// /// The main entry point for the application. @@ -77,6 +96,9 @@ static void Main(string[] args) Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + ExceptionHandler = new ExceptionHandler {MessageBoxButtons = MessageBoxButtons.OK}; + ExceptionHandler.StartHandlingExceptions(); + FrmMain = new FrmMain(); FrmAbout = new FrmAbout(); diff --git a/PrusaSL1Viewer/Properties/AssemblyInfo.cs b/PrusaSL1Viewer/Properties/AssemblyInfo.cs index 75ba680c..e0322166 100644 --- a/PrusaSL1Viewer/Properties/AssemblyInfo.cs +++ b/PrusaSL1Viewer/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.4.0.0")] -[assembly: AssemblyFileVersion("0.4.0.0")] +[assembly: AssemblyVersion("0.4.1.0")] +[assembly: AssemblyFileVersion("0.4.1.0")] diff --git a/PrusaSL1Viewer/Properties/Resources.Designer.cs b/PrusaSL1Viewer/Properties/Resources.Designer.cs index ec18b715..5c64235a 100644 --- a/PrusaSL1Viewer/Properties/Resources.Designer.cs +++ b/PrusaSL1Viewer/Properties/Resources.Designer.cs @@ -160,6 +160,26 @@ internal static System.Drawing.Bitmap Extract_object_16x16 { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap eye_16x16 { + get { + object obj = ResourceManager.GetObject("eye-16x16", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap eye_24x24 { + get { + object obj = ResourceManager.GetObject("eye-24x24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -180,6 +200,16 @@ internal static System.Drawing.Bitmap File_Refresh_16x16 { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap filter_filled_16x16 { + get { + object obj = ResourceManager.GetObject("filter-filled-16x16", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -210,6 +240,76 @@ internal static System.Drawing.Bitmap layers_16x16 { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap mutation_blackhat { + get { + object obj = ResourceManager.GetObject("mutation_blackhat", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap mutation_closing { + get { + object obj = ResourceManager.GetObject("mutation_closing", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap mutation_dilation { + get { + object obj = ResourceManager.GetObject("mutation_dilation", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap mutation_erosion { + get { + object obj = ResourceManager.GetObject("mutation_erosion", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap mutation_gradient { + get { + object obj = ResourceManager.GetObject("mutation_gradient", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap mutation_opening { + get { + object obj = ResourceManager.GetObject("mutation_opening", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap mutation_tophat { + get { + object obj = ResourceManager.GetObject("mutation_tophat", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/PrusaSL1Viewer/Properties/Resources.resx b/PrusaSL1Viewer/Properties/Resources.resx index 869850b6..f8c143c5 100644 --- a/PrusaSL1Viewer/Properties/Resources.resx +++ b/PrusaSL1Viewer/Properties/Resources.resx @@ -118,79 +118,109 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Images\Donate-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Images\File-Refresh-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Images\Ok-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Error-128x128.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Images\layers-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Rotate-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\gui\mutation_closing.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Global-Network-icon-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Back-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\search-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Extract-object-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Cancel-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\File-Refresh-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\SaveAs-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Exit-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Back-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Global-Network-icon-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\Next-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\gui\mutation_erosion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Images\Save-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Exit-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Wrench-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Convert-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\PrusaSL1Viewer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Open-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Ok-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Images\Button-Info-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Geometry-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\filter-filled-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\Cancel-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\Open-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Images\File-Close-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Extract-object-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\search-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Geometry-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\eye-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\Rotate-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\gui\mutation_tophat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\CNCMachine-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\Convert-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\gui\mutation_dilation.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\gui\mutation_gradient.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Images\pixel-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\PrusaSL1Viewer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\SaveAs-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Next-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\gui\mutation_opening.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Error-128x128.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\gui\mutation_blackhat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Wrench-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Cancel-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\Cancel-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\Donate-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\CNCMachine-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\eye-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/PrusaSL1Viewer/PrusaSL1Viewer.csproj b/PrusaSL1Viewer/PrusaSL1Viewer.csproj index 56579646..7582f99c 100644 --- a/PrusaSL1Viewer/PrusaSL1Viewer.csproj +++ b/PrusaSL1Viewer/PrusaSL1Viewer.csproj @@ -57,6 +57,9 @@ PrusaSL1Viewer.ico + + Libraries\ApplicationManagement.dll + ..\packages\BinarySerializer.8.5.1\lib\net46\BinarySerializer.dll @@ -104,6 +107,7 @@ True True + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll @@ -142,6 +146,15 @@ + + Component + + + Form + + + FrmMutation.cs + Form @@ -166,19 +179,17 @@ FrmMain.cs - - UserControl - - - ImageBox.cs - + FrmAbout.cs + + FrmMutation.cs + FrmInputBox.cs @@ -188,9 +199,6 @@ FrmMain.cs - - ImageBox.cs - ResXFileCodeGenerator Resources.Designer.cs @@ -260,6 +268,16 @@ + + + + + + + + + + @@ -275,6 +293,7 @@ false + xcopy /y $(ProjectDir)..\LICENSE $(ProjectDir)$(OutDir) diff --git a/README.md b/README.md index 909d7100..45d5d12d 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ But also, i need victims for test subject. Proceed at your own risk! * View and extract thumbnails * View all used settings * Edit print properties and save file +* Mutate and filter layers * Export file to a folder * Convert SL1 format to another format * Portable (No installation needed) @@ -58,7 +59,7 @@ But also, i need victims for test subject. Proceed at your own risk! * Choose SL1 printer 1. Close PrusaSlicer 1. Open PrusaSL1Viewer -1. Under Menu click -> About -> Install printers into PrusaSlicer + * Under Menu click -> About -> Install printers into PrusaSlicer 1. Open PrusaSlicer and check if profiles are there 1. To clean up interface remove printers that you will not use (OPTIONAL) 1. Duplicate or create your printer and tune the values if required @@ -80,9 +81,11 @@ After some tests without failure you can increase your confidence and ignore thi 1. Windows 7 or greater 2. .NET Framework 4.8 installed (Comes pre-installed on Windows 10 with last updates) +3. 2 GB RAM or higher ### Mac and Linux +(Not tested nor compiled) 1. Latest Mono ## How to use @@ -100,8 +103,6 @@ Are you a developer? This project include a .NET Core library (PrusaSL1Reader) t ## TODO -* Speed up layer preview -* Put convert operation under a task (No GUI freeze) * More file formats * Clean up (always)