diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2020-07-19 06:23:27 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2020-07-19 06:23:27 +0300 |
commit | 97f0e38c07f1a861c829bfa17821726d33302232 (patch) | |
tree | f51807e067ee9cf852ecf3e83917f62f762da495 /UVtools.Core/Extensions/EmguExtensions.cs | |
parent | 9b9438dd4033dff62f88f2c4d7be3060587d3702 (diff) |
v0.6.3.0v0.6.3.0
* (Add) Layer remove button
* (Add) Tool: Layer removal
* (Add) Layer Repair tool: Remove empty layers
* (Add) Issues: Remove a empty layer will effectively remove the layer
* (Fix) SL1: When converting to other format in some cases the parameters on Printer Notes were not respected nor exported (#12)
* (Fix) Pixel Editor: Draw pixels was painting on wrong positions after apply, when refreshing layer some pixels disappear (Spotted by Nicholas Taylor)
Diffstat (limited to 'UVtools.Core/Extensions/EmguExtensions.cs')
-rw-r--r-- | UVtools.Core/Extensions/EmguExtensions.cs | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/UVtools.Core/Extensions/EmguExtensions.cs b/UVtools.Core/Extensions/EmguExtensions.cs index 6b936d9..7022113 100644 --- a/UVtools.Core/Extensions/EmguExtensions.cs +++ b/UVtools.Core/Extensions/EmguExtensions.cs @@ -197,31 +197,17 @@ namespace UVtools.Core.Extensions public static void SetByte(this Mat mat, int pixel, byte value) => SetByte(mat, pixel, new[] {value}); - public static void SetByte(this Mat mat, int pixel, byte[] value) - { - /*var sw = Stopwatch.StartNew(); - var span = new Span<byte>(IntPtr.Add(mat.DataPointer, pixel).ToPointer(), value.Length); - for (int i = 0; i < value.Length; i++) - { - span[i] = value[i]; - } - Debug.Write(sw.ElapsedMilliseconds); - Debug.Write(" - "); - sw.Restart();*/ + public static void SetByte(this Mat mat, int pixel, byte[] value) => Marshal.Copy(value, 0, mat.DataPointer + pixel, value.Length); - //Debug.Write(sw.ElapsedMilliseconds); - } public static void SetByte(this Mat mat, int x, int y, byte value) => SetByte(mat, x, y, new[] {value}); public static void SetByte(this Mat mat, int x, int y, byte[] value) => - SetByte(mat, y * mat.Cols + x, value); + SetByte(mat, y * mat.Step + x * mat.NumberOfChannels, value); - public static void SetBytes(this Mat mat, byte[] value) - { + public static void SetBytes(this Mat mat, byte[] value) => Marshal.Copy(value, 0, mat.DataPointer, value.Length); - } } } |