Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Conceição <Tiago_caza@hotmail.com>2020-06-01 06:31:18 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2020-06-01 06:31:18 +0300
commit15d9b3e7a5d8783493339bfe8f5c73ad74528b4c (patch)
tree36ef289c93cd0250e7f3d4409d7504a0465fd416
parent82f29a7928a21cee772d97ba558230b88faee371 (diff)
v0.4.1v0.4.1
* (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)
-rw-r--r--CHANGELOG.md12
-rw-r--r--PrusaSL1Reader/ChituboxFile.cs6
-rw-r--r--PrusaSL1Reader/PHZFile.cs10
-rw-r--r--PrusaSL1Reader/PrusaSL1Reader.csproj6
-rw-r--r--PrusaSL1Viewer/Controls/SplitButton.cs99
-rw-r--r--PrusaSL1Viewer/FrmMain.cs166
-rw-r--r--PrusaSL1Viewer/FrmMain.resx49
-rw-r--r--PrusaSL1Viewer/FrmMutation.Designer.cs380
-rw-r--r--PrusaSL1Viewer/FrmMutation.cs211
-rw-r--r--PrusaSL1Viewer/FrmMutation.resx (renamed from PrusaSL1Viewer/ImageBox.resx)16
-rw-r--r--PrusaSL1Viewer/ImageBox.Designer.cs46
-rw-r--r--PrusaSL1Viewer/ImageBox.cs65
-rw-r--r--PrusaSL1Viewer/Images/Back-16x16.pngbin186 -> 138 bytes
-rw-r--r--PrusaSL1Viewer/Images/Button-Info-16x16.pngbin791 -> 666 bytes
-rw-r--r--PrusaSL1Viewer/Images/CNCMachine-16x16.pngbin375 -> 261 bytes
-rw-r--r--PrusaSL1Viewer/Images/Cancel-24x24.pngbin995 -> 513 bytes
-rw-r--r--PrusaSL1Viewer/Images/Cancel-32x32.pngbin1339 -> 588 bytes
-rw-r--r--PrusaSL1Viewer/Images/Convert-16x16.pngbin788 -> 629 bytes
-rw-r--r--PrusaSL1Viewer/Images/DataList-16x16.pngbin214 -> 179 bytes
-rw-r--r--PrusaSL1Viewer/Images/Donate-16x16.pngbin769 -> 536 bytes
-rw-r--r--PrusaSL1Viewer/Images/Error-128x128.pngbin1953 -> 889 bytes
-rw-r--r--PrusaSL1Viewer/Images/Exit-16x16.pngbin230 -> 174 bytes
-rw-r--r--PrusaSL1Viewer/Images/Extract-object-16x16.pngbin554 -> 490 bytes
-rw-r--r--PrusaSL1Viewer/Images/File-Close-16x16.pngbin355 -> 247 bytes
-rw-r--r--PrusaSL1Viewer/Images/File-Refresh-16x16.pngbin276 -> 196 bytes
-rw-r--r--PrusaSL1Viewer/Images/GCode-16x16.pngbin274 -> 151 bytes
-rw-r--r--PrusaSL1Viewer/Images/Geometry-16x16.pngbin360 -> 259 bytes
-rw-r--r--PrusaSL1Viewer/Images/Global-Network-icon-16x16.pngbin963 -> 876 bytes
-rw-r--r--PrusaSL1Viewer/Images/Next-16x16.pngbin198 -> 140 bytes
-rw-r--r--PrusaSL1Viewer/Images/Ok-24x24.pngbin548 -> 350 bytes
-rw-r--r--PrusaSL1Viewer/Images/Open-16x16.pngbin326 -> 248 bytes
-rw-r--r--PrusaSL1Viewer/Images/PhotoInfo-16x16.pngbin265 -> 196 bytes
-rw-r--r--PrusaSL1Viewer/Images/Rotate-16x16.pngbin384 -> 259 bytes
-rw-r--r--PrusaSL1Viewer/Images/Save-16x16.pngbin425 -> 247 bytes
-rw-r--r--PrusaSL1Viewer/Images/SaveAs-16x16.pngbin340 -> 244 bytes
-rw-r--r--PrusaSL1Viewer/Images/Wrench-16x16.pngbin347 -> 237 bytes
-rw-r--r--PrusaSL1Viewer/Images/eye-16x16.pngbin0 -> 402 bytes
-rw-r--r--PrusaSL1Viewer/Images/eye-24x24.pngbin0 -> 731 bytes
-rw-r--r--PrusaSL1Viewer/Images/filter-filled-16x16.pngbin0 -> 253 bytes
-rw-r--r--PrusaSL1Viewer/Images/gui/mutation_blackhat.pngbin0 -> 2165 bytes
-rw-r--r--PrusaSL1Viewer/Images/gui/mutation_closing.pngbin0 -> 1427 bytes
-rw-r--r--PrusaSL1Viewer/Images/gui/mutation_dilation.pngbin0 -> 1083 bytes
-rw-r--r--PrusaSL1Viewer/Images/gui/mutation_erosion.pngbin0 -> 1055 bytes
-rw-r--r--PrusaSL1Viewer/Images/gui/mutation_gradient.pngbin0 -> 1280 bytes
-rw-r--r--PrusaSL1Viewer/Images/gui/mutation_opening.pngbin0 -> 1265 bytes
-rw-r--r--PrusaSL1Viewer/Images/gui/mutation_tophat.pngbin0 -> 948 bytes
-rw-r--r--PrusaSL1Viewer/Images/layers-16x16.pngbin459 -> 358 bytes
-rw-r--r--PrusaSL1Viewer/Images/pixel-16x16.pngbin591 -> 454 bytes
-rw-r--r--PrusaSL1Viewer/Images/search-16x16.pngbin50607 -> 344 bytes
-rw-r--r--PrusaSL1Viewer/Libraries/ApplicationManagement.dllbin0 -> 28672 bytes
-rw-r--r--PrusaSL1Viewer/Mutation.cs51
-rw-r--r--PrusaSL1Viewer/Program.cs22
-rw-r--r--PrusaSL1Viewer/Properties/AssemblyInfo.cs4
-rw-r--r--PrusaSL1Viewer/Properties/Resources.Designer.cs100
-rw-r--r--PrusaSL1Viewer/Properties/Resources.resx114
-rw-r--r--PrusaSL1Viewer/PrusaSL1Viewer.csproj37
-rw-r--r--README.md7
57 files changed, 1163 insertions, 238 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 37ef90a..58c0210 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 f671fe3..e4be693 100644
--- a/PrusaSL1Reader/ChituboxFile.cs
+++ b/PrusaSL1Reader/ChituboxFile.cs
@@ -703,11 +703,9 @@ namespace PrusaSL1Reader
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 5d7371e..c2f2ced 100644
--- a/PrusaSL1Reader/PHZFile.cs
+++ b/PrusaSL1Reader/PHZFile.cs
@@ -715,6 +715,10 @@ namespace PrusaSL1Reader
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 @@ namespace PrusaSL1Reader
//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 92d9c60..2682295 100644
--- a/PrusaSL1Reader/PrusaSL1Reader.csproj
+++ b/PrusaSL1Reader/PrusaSL1Reader.csproj
@@ -7,9 +7,9 @@
<PackageProjectUrl>https://github.com/sn4k3/PrusaSL1Viewer</PackageProjectUrl>
<PackageIcon></PackageIcon>
<RepositoryUrl>https://github.com/sn4k3/PrusaSL1Viewer</RepositoryUrl>
- <AssemblyVersion>0.4.0.0</AssemblyVersion>
- <FileVersion>0.4.4.0</FileVersion>
- <Version>0.4</Version>
+ <AssemblyVersion>0.4.1.0</AssemblyVersion>
+ <FileVersion>0.4.1.0</FileVersion>
+ <Version>0.4.1</Version>
<Description>Open, view, edit, extract and convert DLP/SLA files generated from Slicers</Description>
</PropertyGroup>
diff --git a/PrusaSL1Viewer/Controls/SplitButton.cs b/PrusaSL1Viewer/Controls/SplitButton.cs
new file mode 100644
index 0000000..57140e4
--- /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. <https://fsf.org/>
+ * 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 d5a965f..a4126af 100644
--- a/PrusaSL1Viewer/FrmMain.cs
+++ b/PrusaSL1Viewer/FrmMain.cs
@@ -14,6 +14,8 @@ using System.IO;
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.PixelFormats;
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<eMutate, string> MutateDescriptions = new Dictionary<eMutate, string>
- {
- {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<Mutation.Mutates, Mutation> Mutations =
+ new Dictionary<Mutation.Mutates, Mutation>
+ {
+ {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 @@ namespace PrusaSL1Viewer
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 @@ namespace PrusaSL1Viewer
}
- 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 @@ namespace PrusaSL1Viewer
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 @@ namespace PrusaSL1Viewer
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 @@ namespace PrusaSL1Viewer
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 ece3314..4d21ad4 100644
--- a/PrusaSL1Viewer/FrmMain.resx
+++ b/PrusaSL1Viewer/FrmMain.resx
@@ -126,12 +126,6 @@
<metadata name="tsLayer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>201, 17</value>
</metadata>
- <metadata name="tsThumbnails.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>291, 17</value>
- </metadata>
- <metadata name="tsProperties.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>649, 17</value>
- </metadata>
<metadata name="tsGCode.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>551, 17</value>
</metadata>
@@ -143,37 +137,37 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADg
- CAAAAk1TRnQBSQFMAgEBAwEAASABAQEgAQEBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
+ CAAAAk1TRnQBSQFMAgEBAwEAATABAQEwAQEBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABEAMAAQEBAAEgBgABEFYAA1ABowNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNS
AakDUgGpA1IBqQNQAaOEAANVAbQDWQHHAy8BSQMAAQEDGwEmAxwBJwMcAScDHAEnAxwBJwMcAScDHAEn
AxwBJwMcAScDHAEnAxwBJwMCAQMEAANSAakwAANSAakQAAMnAToDMAFMAzABTAMwAUwDMAFMAzABTAMw
AUwDMAFMAzABTAMnATpPAAH/AwAB/wNDAXcDKQE+AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMA
Af8DAAH/AwAB/wMAAf8DMgFRBAADUgGpBAADUAGdA1MBqgNTAaoDUwGqA1MBqgNTAaoDUwGqA1ABnQwA
- A1IBqRAAA04B+wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/A04B+0wAA1EBogNWAbYDKgFA
+ A1IBqRAAA04B+wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/wMpAf8DKQH/A04B+0wAA1EBogNWAbYDKgFA
BAADEAEVAxEBFwMRARcDEQEXAxEBFwMRARcDEQEXAxEBFwMRARcDEQEXAxABFggAA1IBqQQAA1ABnQNT
- AaoDUwGqAx8BLBwAA1IBqRAAAysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/0wA
- AwoBDgMRARcDAAEBOAADUgGpMAADUgGpEAADKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMr
- Af8DKwH/TAADUgH0AwAB/wM+AWwDDgETA0IBdgNDAXcDQwF3A0MBdwNDAXcDQwF3A0MBdwNDAXcDQwF3
+ AaoDUwGqAx8BLBwAA1IBqRAAAykB/wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/0wA
+ AwoBDgMRARcDAAEBOAADUgGpMAADUgGpEAADKQH/AykB/wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/wMp
+ Af8DKQH/TAADUgH0AwAB/wM+AWwDDgETA0IBdgNDAXcDQwF3A0MBdwNDAXcDQwF3A0MBdwNDAXcDQwF3
A0MBdwNCAXYDFAEbBAADUgGpAyIBMgNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNS
- AakDIgEyA1IBqRAAAysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/08AAf4DAAH/
+ AakDIgEyA1IBqRAAAykB/wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/08AAf4DAAH/
A0MBdwMeASsDVwHFA1kBxwNZAccDWQHHA1kBxwNZAccDWQHHA1kBxwNZAccDWQHHA1gBxgMmATkEAANS
- AakDNAFVAzQBVSAAAzQBVQM0AVUDUgGpEAADKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMr
- Af8DKwH/TAADMwFTAzwBZwMUARw4AANSAakDNAFVAzQBVQNGAYADUgGpA1IBqQNSAakDUgGpA1IBqQNS
- AakDRQF/AzQBVQM0AVUDUgGpEAADKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/
+ AakDNAFVAzQBVSAAAzQBVQM0AVUDUgGpEAADKQH/AykB/wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/wMp
+ Af8DKQH/TAADMwFTAzwBZwMUARw4AANSAakDNAFVAzQBVQNGAYADUgGpA1IBqQNSAakDUgGpA1IBqQNS
+ AakDRQF/AzQBVQM0AVUDUgGpEAADKQH/AykB/wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/wMpAf8DKQH/
TAADMwFTAzwBZwMUARw4AANSAakDNAFVAzQBVQM/AW4DMgFQEAADJwE7A0QBfAM0AVUDNAFVA1IBqRAA
- AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/08AAf4DAAH/A0MBdwMfASwDVwHF
+ AykB/wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/wMpAf8DKQH/AykB/08AAf4DAAH/A0MBdwMfASwDVwHF
A1kBxwNZAccDWQHHA1kBxwNZAccDWQHHA1kBxwNZAccDWQHHA1gBxgMmATkEAANSAakDNAFVAzQBVQMF
- AQcDVQG1AxEBFwNSAakDKQE+BAADUAGfAxEBFwM0AVUDNAFVA1IBqRAAAysB/wMrAf8DKwH/AysB/wMr
- Af8DKwH/AysB/wMrAf8DKwH/AysB/0wAA1IB9AMAAf8DPgFsAw4BEwNCAXUDQwF3A0MBdwNDAXcDQwF3
+ AQcDVQG1AxEBFwNSAakDKQE+BAADUAGfAxEBFwM0AVUDNAFVA1IBqRAAAykB/wMpAf8DKQH/AykB/wMp
+ Af8DKQH/AykB/wMpAf8DKQH/AykB/0wAA1IB9AMAAf8DPgFsAw4BEwNCAXUDQwF3A0MBdwNDAXcDQwF3
A0MBdwNDAXcDQwF3A0MBdwNDAXcDQwF3AxQBGwQAA1IBqQM0AVUDNAFVBAADPAFoA1YBvgMjATQDVQG1
- AxIBGQNRAaAEAAM0AVUDNAFVA1IBqRAAAysB/wMrAf8DKwH/AysB/wMrAf8DKwH/Ay8B/wM0Af8DNAH/
+ AxIBGQNRAaAEAAM0AVUDNAFVA1IBqRAAAykB/wMpAf8DKQH/AykB/wMpAf8DKQH/Ay0B/wMyAf8DMgH/
A1wB30wAAwoBDgMRARcDAAEBOAADUgGpAzQBVQM0AVUDAAEBAy0BRgMKAQ4EAAM5AV8DXAHOAygBPAQA
- AzQBVQM0AVUDUgGpEAADKwH/A4IB/wNKAf8DNAH/AysB/wMrAf8DPgH/A0UB/wNcAd8DFwEgTAADUQGi
+ AzQBVQM0AVUDUgGpEAADKQH/A4IB/wNIAf8DMgH/AykB/wMpAf8DPAH/A0MB/wNcAd8DFwEgTAADUQGi
A1YBtgMqAUAEAAMQARUDEQEXAxEBFwMRARcDEQEXAxEBFwMRARcDEQEXAxEBFwMRARcDEAEWCAADUgGp
- AzQBVQM0AVUDMwFTA1IBpgNKAYwHAAEBA0cBgwgAAzQBVQM0AVUDUgGpEAADKwH/A5kB/wOFAf8DVwH/
- AysB/wMrAf8DPgH/A1wB3wMXASBTAAH/AwAB/wNDAXcDKQE+AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/
+ AzQBVQM0AVUDMwFTA1IBpgNKAYwHAAEBA0cBgwgAAzQBVQM0AVUDUgGpEAADKQH/A5kB/wOFAf8DVQH/
+ AykB/wMpAf8DPAH/A1wB3wMXASBTAAH/AwAB/wNDAXcDKQE+AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/
AwAB/wMAAf8DAAH/AwAB/wMAAf8DMgFRBAADUgGpAzQBVQM0AVUDEQEXA1ABngMkATYUAAM0AVUDNAFV
- A1IBqRAAA1AB+wM2Af8DNgH/AzYB/wMrAf8DKwH/A1wB3wMXASBUAANVAbQDWQHHAy8BSQMAAQEDGwEm
+ A1IBqRAAA1AB+wM0Af8DNAH/AzQB/wMpAf8DKQH/A1wB3wMXASBUAANVAbQDWQHHAy8BSQMAAQEDGwEm
AxwBJwMcAScDHAEnAxwBJwMcAScDHAEnAxwBJwMcAScDHAEnAxwBJwMCAQMEAANSAakDIgEyA1IBqQNS
AakDUgGpA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQMiATIDUgGpEAADIAEuAykBPwMpAT8DKQE/
AykBPwMpAT8DEQEXnAADUAGjA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNS
@@ -183,6 +177,15 @@
Af8BgQERAeABBwIAARABAQGBATEB4AEPBAABgQHxAeABHwQAAYABAQHgAT8CAAL/AYABAQL/AgAL
</value>
</data>
+ <metadata name="tsThumbnails.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>291, 17</value>
+ </metadata>
+ <metadata name="tsProperties.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>649, 17</value>
+ </metadata>
+ <metadata name="tsGCode.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>551, 17</value>
+ </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
diff --git a/PrusaSL1Viewer/FrmMutation.Designer.cs b/PrusaSL1Viewer/FrmMutation.Designer.cs
new file mode 100644
index 0000000..80776ec
--- /dev/null
+++ b/PrusaSL1Viewer/FrmMutation.Designer.cs
@@ -0,0 +1,380 @@
+namespace PrusaSL1Viewer
+{
+ partial class FrmMutation
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ 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 0000000..bbadb3b
--- /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. <https://fsf.org/>
+ * 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
index 1af7de1..40776f4 100644
--- a/PrusaSL1Viewer/ImageBox.resx
+++ b/PrusaSL1Viewer/FrmMutation.resx
@@ -117,4 +117,20 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>148, 17</value>
+ </metadata>
+ <data name="lbIterationsStart.ToolTip" xml:space="preserve">
+ <value>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!</value>
+ </data>
+ <data name="lbLayerRange.ToolTip" xml:space="preserve">
+ <value>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".</value>
+ </data>
+ <metadata name="cmLayerRange.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
</root> \ No newline at end of file
diff --git a/PrusaSL1Viewer/ImageBox.Designer.cs b/PrusaSL1Viewer/ImageBox.Designer.cs
deleted file mode 100644
index 9e71e8e..0000000
--- a/PrusaSL1Viewer/ImageBox.Designer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-namespace PrusaSL1Viewer
-{
- partial class ImageBox
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- 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 985669b..0000000
--- 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<L8> 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<L8> image)
- {
- Image = image;
-
- }
- }
-}
diff --git a/PrusaSL1Viewer/Images/Back-16x16.png b/PrusaSL1Viewer/Images/Back-16x16.png
index 1968f0d..c28c621 100644
--- a/PrusaSL1Viewer/Images/Back-16x16.png
+++ b/PrusaSL1Viewer/Images/Back-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Button-Info-16x16.png b/PrusaSL1Viewer/Images/Button-Info-16x16.png
index a9e4997..6b0d295 100644
--- a/PrusaSL1Viewer/Images/Button-Info-16x16.png
+++ b/PrusaSL1Viewer/Images/Button-Info-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/CNCMachine-16x16.png b/PrusaSL1Viewer/Images/CNCMachine-16x16.png
index dbafe4d..e2a5e4b 100644
--- a/PrusaSL1Viewer/Images/CNCMachine-16x16.png
+++ b/PrusaSL1Viewer/Images/CNCMachine-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Cancel-24x24.png b/PrusaSL1Viewer/Images/Cancel-24x24.png
index b5a6920..74e4559 100644
--- a/PrusaSL1Viewer/Images/Cancel-24x24.png
+++ b/PrusaSL1Viewer/Images/Cancel-24x24.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Cancel-32x32.png b/PrusaSL1Viewer/Images/Cancel-32x32.png
index 6c28da1..a732caa 100644
--- a/PrusaSL1Viewer/Images/Cancel-32x32.png
+++ b/PrusaSL1Viewer/Images/Cancel-32x32.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Convert-16x16.png b/PrusaSL1Viewer/Images/Convert-16x16.png
index 75ea569..76cf3c4 100644
--- a/PrusaSL1Viewer/Images/Convert-16x16.png
+++ b/PrusaSL1Viewer/Images/Convert-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/DataList-16x16.png b/PrusaSL1Viewer/Images/DataList-16x16.png
index b0e24de..a4e784c 100644
--- a/PrusaSL1Viewer/Images/DataList-16x16.png
+++ b/PrusaSL1Viewer/Images/DataList-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Donate-16x16.png b/PrusaSL1Viewer/Images/Donate-16x16.png
index 20d8f08..8d9d6f1 100644
--- a/PrusaSL1Viewer/Images/Donate-16x16.png
+++ b/PrusaSL1Viewer/Images/Donate-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Error-128x128.png b/PrusaSL1Viewer/Images/Error-128x128.png
index b26a92b..d676c15 100644
--- a/PrusaSL1Viewer/Images/Error-128x128.png
+++ b/PrusaSL1Viewer/Images/Error-128x128.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Exit-16x16.png b/PrusaSL1Viewer/Images/Exit-16x16.png
index a111b84..863566c 100644
--- a/PrusaSL1Viewer/Images/Exit-16x16.png
+++ b/PrusaSL1Viewer/Images/Exit-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Extract-object-16x16.png b/PrusaSL1Viewer/Images/Extract-object-16x16.png
index 1283fc3..9bdb1d2 100644
--- a/PrusaSL1Viewer/Images/Extract-object-16x16.png
+++ b/PrusaSL1Viewer/Images/Extract-object-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/File-Close-16x16.png b/PrusaSL1Viewer/Images/File-Close-16x16.png
index 9144092..ef36711 100644
--- a/PrusaSL1Viewer/Images/File-Close-16x16.png
+++ b/PrusaSL1Viewer/Images/File-Close-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/File-Refresh-16x16.png b/PrusaSL1Viewer/Images/File-Refresh-16x16.png
index 8407ab3..39d6920 100644
--- a/PrusaSL1Viewer/Images/File-Refresh-16x16.png
+++ b/PrusaSL1Viewer/Images/File-Refresh-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/GCode-16x16.png b/PrusaSL1Viewer/Images/GCode-16x16.png
index c33c4a3..127cecc 100644
--- a/PrusaSL1Viewer/Images/GCode-16x16.png
+++ b/PrusaSL1Viewer/Images/GCode-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Geometry-16x16.png b/PrusaSL1Viewer/Images/Geometry-16x16.png
index db04a86..da022c5 100644
--- a/PrusaSL1Viewer/Images/Geometry-16x16.png
+++ b/PrusaSL1Viewer/Images/Geometry-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Global-Network-icon-16x16.png b/PrusaSL1Viewer/Images/Global-Network-icon-16x16.png
index 971ded6..0c4e3be 100644
--- a/PrusaSL1Viewer/Images/Global-Network-icon-16x16.png
+++ b/PrusaSL1Viewer/Images/Global-Network-icon-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Next-16x16.png b/PrusaSL1Viewer/Images/Next-16x16.png
index 15348a5..9d8f5e4 100644
--- a/PrusaSL1Viewer/Images/Next-16x16.png
+++ b/PrusaSL1Viewer/Images/Next-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Ok-24x24.png b/PrusaSL1Viewer/Images/Ok-24x24.png
index 1063d21..e4cc79d 100644
--- a/PrusaSL1Viewer/Images/Ok-24x24.png
+++ b/PrusaSL1Viewer/Images/Ok-24x24.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Open-16x16.png b/PrusaSL1Viewer/Images/Open-16x16.png
index 5117a1c..40fcd9a 100644
--- a/PrusaSL1Viewer/Images/Open-16x16.png
+++ b/PrusaSL1Viewer/Images/Open-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/PhotoInfo-16x16.png b/PrusaSL1Viewer/Images/PhotoInfo-16x16.png
index f5077ee..f6a4c2f 100644
--- a/PrusaSL1Viewer/Images/PhotoInfo-16x16.png
+++ b/PrusaSL1Viewer/Images/PhotoInfo-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Rotate-16x16.png b/PrusaSL1Viewer/Images/Rotate-16x16.png
index 9061e0f..55f04c6 100644
--- a/PrusaSL1Viewer/Images/Rotate-16x16.png
+++ b/PrusaSL1Viewer/Images/Rotate-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Save-16x16.png b/PrusaSL1Viewer/Images/Save-16x16.png
index c3f3d12..38ce759 100644
--- a/PrusaSL1Viewer/Images/Save-16x16.png
+++ b/PrusaSL1Viewer/Images/Save-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/SaveAs-16x16.png b/PrusaSL1Viewer/Images/SaveAs-16x16.png
index 33cf007..e22cce7 100644
--- a/PrusaSL1Viewer/Images/SaveAs-16x16.png
+++ b/PrusaSL1Viewer/Images/SaveAs-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Wrench-16x16.png b/PrusaSL1Viewer/Images/Wrench-16x16.png
index 7e3bae4..2838a76 100644
--- a/PrusaSL1Viewer/Images/Wrench-16x16.png
+++ b/PrusaSL1Viewer/Images/Wrench-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/eye-16x16.png b/PrusaSL1Viewer/Images/eye-16x16.png
new file mode 100644
index 0000000..4f3c7e2
--- /dev/null
+++ b/PrusaSL1Viewer/Images/eye-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/eye-24x24.png b/PrusaSL1Viewer/Images/eye-24x24.png
new file mode 100644
index 0000000..190959b
--- /dev/null
+++ b/PrusaSL1Viewer/Images/eye-24x24.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/filter-filled-16x16.png b/PrusaSL1Viewer/Images/filter-filled-16x16.png
new file mode 100644
index 0000000..d091922
--- /dev/null
+++ b/PrusaSL1Viewer/Images/filter-filled-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/gui/mutation_blackhat.png b/PrusaSL1Viewer/Images/gui/mutation_blackhat.png
new file mode 100644
index 0000000..80f1cd0
--- /dev/null
+++ b/PrusaSL1Viewer/Images/gui/mutation_blackhat.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/gui/mutation_closing.png b/PrusaSL1Viewer/Images/gui/mutation_closing.png
new file mode 100644
index 0000000..79e02c6
--- /dev/null
+++ b/PrusaSL1Viewer/Images/gui/mutation_closing.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/gui/mutation_dilation.png b/PrusaSL1Viewer/Images/gui/mutation_dilation.png
new file mode 100644
index 0000000..92e1952
--- /dev/null
+++ b/PrusaSL1Viewer/Images/gui/mutation_dilation.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/gui/mutation_erosion.png b/PrusaSL1Viewer/Images/gui/mutation_erosion.png
new file mode 100644
index 0000000..8f2422c
--- /dev/null
+++ b/PrusaSL1Viewer/Images/gui/mutation_erosion.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/gui/mutation_gradient.png b/PrusaSL1Viewer/Images/gui/mutation_gradient.png
new file mode 100644
index 0000000..7b60d70
--- /dev/null
+++ b/PrusaSL1Viewer/Images/gui/mutation_gradient.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/gui/mutation_opening.png b/PrusaSL1Viewer/Images/gui/mutation_opening.png
new file mode 100644
index 0000000..6ddb9f5
--- /dev/null
+++ b/PrusaSL1Viewer/Images/gui/mutation_opening.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/gui/mutation_tophat.png b/PrusaSL1Viewer/Images/gui/mutation_tophat.png
new file mode 100644
index 0000000..60c1c84
--- /dev/null
+++ b/PrusaSL1Viewer/Images/gui/mutation_tophat.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/layers-16x16.png b/PrusaSL1Viewer/Images/layers-16x16.png
index efc9a32..b8f66f5 100644
--- a/PrusaSL1Viewer/Images/layers-16x16.png
+++ b/PrusaSL1Viewer/Images/layers-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/pixel-16x16.png b/PrusaSL1Viewer/Images/pixel-16x16.png
index 74611c2..d7c46a7 100644
--- a/PrusaSL1Viewer/Images/pixel-16x16.png
+++ b/PrusaSL1Viewer/Images/pixel-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/search-16x16.png b/PrusaSL1Viewer/Images/search-16x16.png
index 99ae5d0..ea9d8e2 100644
--- a/PrusaSL1Viewer/Images/search-16x16.png
+++ b/PrusaSL1Viewer/Images/search-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Libraries/ApplicationManagement.dll b/PrusaSL1Viewer/Libraries/ApplicationManagement.dll
new file mode 100644
index 0000000..3e7d793
--- /dev/null
+++ b/PrusaSL1Viewer/Libraries/ApplicationManagement.dll
Binary files differ
diff --git a/PrusaSL1Viewer/Mutation.cs b/PrusaSL1Viewer/Mutation.cs
new file mode 100644
index 0000000..5e80e80
--- /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. <https://fsf.org/>
+ * 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 d8cf1b5..a26cecc 100644
--- a/PrusaSL1Viewer/Program.cs
+++ b/PrusaSL1Viewer/Program.cs
@@ -11,6 +11,8 @@ using System.Drawing;
using System.Globalization;
using System.Threading;
using System.Windows.Forms;
+using ApplicationManagement;
+using Emgu.CV;
using PrusaSL1Reader;
namespace PrusaSL1Viewer
@@ -61,9 +63,26 @@ namespace PrusaSL1Viewer
};
}
+ public static Matrix<byte> KernelStar3x3 { get; } = new Matrix<byte>(new byte[,]
+ {
+ { 0, 1, 0 },
+ { 1, 0, 1 },
+ { 0, 1, 0 }
+ });
+
+ public static Matrix<sbyte> KernelFindIsolated { get; } = new Matrix<sbyte>(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; }
/// <summary>
/// The main entry point for the application.
@@ -77,6 +96,9 @@ namespace PrusaSL1Viewer
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 75ba680..e032216 100644
--- a/PrusaSL1Viewer/Properties/AssemblyInfo.cs
+++ b/PrusaSL1Viewer/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 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 ec18b71..5c64235 100644
--- a/PrusaSL1Viewer/Properties/Resources.Designer.cs
+++ b/PrusaSL1Viewer/Properties/Resources.Designer.cs
@@ -163,6 +163,26 @@ namespace PrusaSL1Viewer.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
+ internal static System.Drawing.Bitmap eye_16x16 {
+ get {
+ object obj = ResourceManager.GetObject("eye-16x16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
+ internal static System.Drawing.Bitmap eye_24x24 {
+ get {
+ object obj = ResourceManager.GetObject("eye-24x24", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
internal static System.Drawing.Bitmap File_Close_16x16 {
get {
object obj = ResourceManager.GetObject("File-Close-16x16", resourceCulture);
@@ -183,6 +203,16 @@ namespace PrusaSL1Viewer.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
+ internal static System.Drawing.Bitmap filter_filled_16x16 {
+ get {
+ object obj = ResourceManager.GetObject("filter-filled-16x16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
internal static System.Drawing.Bitmap Geometry_16x16 {
get {
object obj = ResourceManager.GetObject("Geometry-16x16", resourceCulture);
@@ -213,6 +243,76 @@ namespace PrusaSL1Viewer.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
+ internal static System.Drawing.Bitmap mutation_blackhat {
+ get {
+ object obj = ResourceManager.GetObject("mutation_blackhat", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
+ internal static System.Drawing.Bitmap mutation_closing {
+ get {
+ object obj = ResourceManager.GetObject("mutation_closing", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
+ internal static System.Drawing.Bitmap mutation_dilation {
+ get {
+ object obj = ResourceManager.GetObject("mutation_dilation", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
+ internal static System.Drawing.Bitmap mutation_erosion {
+ get {
+ object obj = ResourceManager.GetObject("mutation_erosion", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
+ internal static System.Drawing.Bitmap mutation_gradient {
+ get {
+ object obj = ResourceManager.GetObject("mutation_gradient", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
+ internal static System.Drawing.Bitmap mutation_opening {
+ get {
+ object obj = ResourceManager.GetObject("mutation_opening", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
+ internal static System.Drawing.Bitmap mutation_tophat {
+ get {
+ object obj = ResourceManager.GetObject("mutation_tophat", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
internal static System.Drawing.Bitmap Next_16x16 {
get {
object obj = ResourceManager.GetObject("Next-16x16", resourceCulture);
diff --git a/PrusaSL1Viewer/Properties/Resources.resx b/PrusaSL1Viewer/Properties/Resources.resx
index 869850b..f8c143c 100644
--- a/PrusaSL1Viewer/Properties/Resources.resx
+++ b/PrusaSL1Viewer/Properties/Resources.resx
@@ -118,79 +118,109 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <data name="Donate-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Donate-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
- </data>
- <data name="File-Refresh-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\File-Refresh-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
- </data>
- <data name="Ok-24x24" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Ok-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Error-128x128" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Error-128x128.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="layers-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\layers-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Rotate-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Rotate-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="mutation_closing" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\gui\mutation_closing.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Global-Network-icon-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Global-Network-icon-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Back-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Back-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="search-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\search-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Extract-object-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Extract-object-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Cancel-24x24" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Cancel-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="File-Refresh-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\File-Refresh-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="SaveAs-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\SaveAs-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Exit-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Exit-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Back-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Back-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Global-Network-icon-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Global-Network-icon-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="Next-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Next-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="mutation_erosion" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\gui\mutation_erosion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Save-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Save-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Exit-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Exit-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Wrench-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Wrench-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Convert-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Convert-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="PrusaSL1Viewer" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\PrusaSL1Viewer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Open-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Open-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Ok-24x24" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Ok-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Button-Info-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Button-Info-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="Geometry-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Geometry-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="filter-filled-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\filter-filled-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="Cancel-32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Cancel-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="Open-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Open-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
<data name="File-Close-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\File-Close-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Extract-object-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Extract-object-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="search-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\search-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Geometry-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Geometry-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="eye-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\eye-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="Rotate-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Rotate-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="mutation_tophat" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\gui\mutation_tophat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="CNCMachine-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\CNCMachine-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="Convert-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Convert-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="mutation_dilation" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\gui\mutation_dilation.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="mutation_gradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\gui\mutation_gradient.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pixel-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\pixel-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="PrusaSL1Viewer" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\PrusaSL1Viewer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="SaveAs-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\SaveAs-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Next-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Next-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="mutation_opening" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\gui\mutation_opening.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Error-128x128" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Error-128x128.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="mutation_blackhat" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\gui\mutation_blackhat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Wrench-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Wrench-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Cancel-24x24" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Cancel-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Cancel-32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Cancel-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Donate-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Donate-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="CNCMachine-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\CNCMachine-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="eye-24x24" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\eye-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> \ No newline at end of file
diff --git a/PrusaSL1Viewer/PrusaSL1Viewer.csproj b/PrusaSL1Viewer/PrusaSL1Viewer.csproj
index 5657964..7582f99 100644
--- a/PrusaSL1Viewer/PrusaSL1Viewer.csproj
+++ b/PrusaSL1Viewer/PrusaSL1Viewer.csproj
@@ -57,6 +57,9 @@
<ApplicationIcon>PrusaSL1Viewer.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="ApplicationManagement">
+ <HintPath>Libraries\ApplicationManagement.dll</HintPath>
+ </Reference>
<Reference Include="BinarySerializer, Version=8.5.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\BinarySerializer.8.5.1\lib\net46\BinarySerializer.dll</HintPath>
</Reference>
@@ -104,6 +107,7 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
+ <Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
@@ -142,6 +146,15 @@
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="Controls\SplitButton.cs">
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="FrmMutation.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="FrmMutation.Designer.cs">
+ <DependentUpon>FrmMutation.cs</DependentUpon>
+ </Compile>
<Compile Include="FrmInputBox.cs">
<SubType>Form</SubType>
</Compile>
@@ -166,19 +179,17 @@
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
- <Compile Include="ImageBox.cs">
- <SubType>UserControl</SubType>
- </Compile>
- <Compile Include="ImageBox.Designer.cs">
- <DependentUpon>ImageBox.cs</DependentUpon>
- </Compile>
<Compile Include="EmguExtensions.cs" />
<Compile Include="ImageSharpExtensions.cs" />
+ <Compile Include="Mutation.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmAbout.resx">
<DependentUpon>FrmAbout.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="FrmMutation.resx">
+ <DependentUpon>FrmMutation.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="FrmInputBox.resx">
<DependentUpon>FrmInputBox.cs</DependentUpon>
</EmbeddedResource>
@@ -188,9 +199,6 @@
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
- <EmbeddedResource Include="ImageBox.resx">
- <DependentUpon>ImageBox.cs</DependentUpon>
- </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -260,6 +268,16 @@
<None Include="Images\pixel-16x16.png" />
<None Include="Images\Geometry-16x16.png" />
<None Include="Images\CNCMachine-16x16.png" />
+ <None Include="Images\gui\mutation_blackhat.png" />
+ <None Include="Images\gui\mutation_closing.png" />
+ <None Include="Images\gui\mutation_dilation.png" />
+ <None Include="Images\gui\mutation_erosion.png" />
+ <None Include="Images\gui\mutation_gradient.png" />
+ <None Include="Images\gui\mutation_opening.png" />
+ <None Include="Images\gui\mutation_tophat.png" />
+ <None Include="Images\eye-16x16.png" />
+ <None Include="Images\filter-filled-16x16.png" />
+ <None Include="Images\eye-24x24.png" />
<Content Include="License-LGPL.txt" />
<Content Include="PrusaSL1Viewer.ico" />
</ItemGroup>
@@ -275,6 +293,7 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /y $(ProjectDir)..\LICENSE $(ProjectDir)$(OutDir)
diff --git a/README.md b/README.md
index 909d710..45d5d12 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)