diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2020-10-21 01:41:38 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2020-10-21 01:41:38 +0300 |
commit | 661cb1cf99eb0e8baaa49e075dfd5c20440e9fab (patch) | |
tree | 4f0210066a8b1015863d21ce7589cd01e7b7cb8d /UVtools.Core/Extensions/EmguExtensions.cs | |
parent | d709cdda4105b76d61fe7089d41df63a7112ba74 (diff) |
WPF progress
Diffstat (limited to 'UVtools.Core/Extensions/EmguExtensions.cs')
-rw-r--r-- | UVtools.Core/Extensions/EmguExtensions.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/UVtools.Core/Extensions/EmguExtensions.cs b/UVtools.Core/Extensions/EmguExtensions.cs index e022816..0791ec4 100644 --- a/UVtools.Core/Extensions/EmguExtensions.cs +++ b/UVtools.Core/Extensions/EmguExtensions.cs @@ -18,6 +18,9 @@ namespace UVtools.Core.Extensions public static class EmguExtensions { public static readonly MCvScalar BlackByte = new MCvScalar(0); + public static readonly MCvScalar Black3Byte = new MCvScalar(0, 0, 0); + public static readonly MCvScalar Transparent4Byte = new MCvScalar(0, 0, 0, 0); + public static readonly MCvScalar Black4Byte = new MCvScalar(0, 0, 0, 255); public static unsafe byte* GetBytePointer(this Mat mat) { @@ -216,7 +219,19 @@ namespace UVtools.Core.Extensions public static Mat InitMat(Size size, DepthType depthType = DepthType.Cv8U, int channels = 1) { var mat = new Mat(size, depthType, channels); - mat.SetTo(BlackByte); + switch (channels) + { + case 1: + mat.SetTo(BlackByte); + break; + case 3: + mat.SetTo(Black3Byte); + break; + case 4: + mat.SetTo(Transparent4Byte); + break; + } + return mat; } |