diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-04-05 23:24:00 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-04-05 23:24:00 +0300 |
commit | 47777024363a2836e3ae203d7bb6995facac23a4 (patch) | |
tree | 86177e51c61f5528c551a91f7a8fc16dc2aeb830 /UVtools.Core/Extensions/EmguExtensions.cs | |
parent | 824805a190f3023f3c42d19d50c41f18a83c751d (diff) |
v2.8.2v2.8.2
* **Operations:**
* Force validate all operations on execute if they haven't been before, if validation fails it will show the message error
* Add some utility functions to ease layer and mat allocation in the file
* Layer remove: Disallow to select and remove all layers
* Tool - Edit print parameters: Retract speed wasn't propagating the value to normal layers
* File formats: Better control, set and checking for null/empty thumbnails
Diffstat (limited to 'UVtools.Core/Extensions/EmguExtensions.cs')
-rw-r--r-- | UVtools.Core/Extensions/EmguExtensions.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/UVtools.Core/Extensions/EmguExtensions.cs b/UVtools.Core/Extensions/EmguExtensions.cs index a6aa974..48a9da8 100644 --- a/UVtools.Core/Extensions/EmguExtensions.cs +++ b/UVtools.Core/Extensions/EmguExtensions.cs @@ -298,5 +298,29 @@ namespace UVtools.Core.Extensions return newMat; } + /// <summary> + /// Allocates a new array of mat 's + /// </summary> + /// <param name="count">Array size</param> + /// <returns></returns> + public static Mat[] Allocate(uint count) => Allocate(count, Size.Empty); + + /// <summary> + /// Allocates a new array of mat 's + /// </summary> + /// <param name="count">Array size</param> + /// <param name="size">Image size to create, use <see cref="Size.Empty"/> to create a empty Mat</param> + /// <returns>New mat array</returns> + public static Mat[] Allocate(uint count, Size size) + { + var layers = new Mat[count]; + for (var i = 0; i < layers.Length; i++) + { + layers[i] = size == Size.Empty ? new Mat() : InitMat(size); + } + + return layers; + } + } } |