diff options
Diffstat (limited to 'UVtools.Core/Layer/Layer.cs')
-rw-r--r-- | UVtools.Core/Layer/Layer.cs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/UVtools.Core/Layer/Layer.cs b/UVtools.Core/Layer/Layer.cs index b9401a7..d996d83 100644 --- a/UVtools.Core/Layer/Layer.cs +++ b/UVtools.Core/Layer/Layer.cs @@ -568,6 +568,15 @@ namespace UVtools.Core } } + public void MutateMask(Mat mask) + { + using (var mat = LayerMat) + { + CvInvoke.BitwiseAnd(mat, mask, mat); + LayerMat = mat; + } + } + public void MutatePixelDimming(Matrix<byte> evenPattern = null, Matrix<byte> oddPattern = null, ushort borderSize = 5) { var anchor = new Point(-1, -1); @@ -602,7 +611,7 @@ namespace UVtools.Core { using (Mat mask = dst.CloneBlank()) { - CvInvoke.Erode(dst, erode, kernel, anchor, borderSize, BorderType.Default, default); + CvInvoke.Erode(dst, erode, kernel, anchor, borderSize, BorderType.Reflect101, default); CvInvoke.Subtract(dst, erode, diff); if (Index % 2 == 0) @@ -643,7 +652,7 @@ namespace UVtools.Core { using (Mat diff = new Mat()) { - CvInvoke.Erode(dst, erode, kernel, anchor, borderSize, BorderType.Default, default); + CvInvoke.Erode(dst, erode, kernel, anchor, borderSize, BorderType.Reflect101, default); CvInvoke.Subtract(dst, erode, diff); CvInvoke.BitwiseAnd(erode, Index % 2 == 0 ? evenPatternMask : oddPatternMask, dst); CvInvoke.Add(dst, diff, dst); @@ -834,8 +843,6 @@ namespace UVtools.Core } } - - public Layer Clone() { return new Layer(Index, CompressedBytes, Filename, ParentLayerManager) @@ -849,6 +856,7 @@ namespace UVtools.Core #endregion + } } |