[Multimedia] Added paramName to every ValidateEnum call. (#83)
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Vision / MediaVision / BarcodeImageConfiguration.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace Tizen.Multimedia.Vision
20 {
21     /// <summary>
22     /// Represents a configuration for the image to be generated by <see cref="BarcodeGenerator"/>.
23     /// </summary>
24     /// <since_tizen> 4 </since_tizen>
25     public class BarcodeImageConfiguration
26     {
27         /// <summary>
28         /// Initializes a new instance of the <see cref="BarcodeImageConfiguration"/> class.
29         /// </summary>
30         /// <remarks>
31         /// The mediastorage privilege (http://tizen.org/privilege/mediastorage) is needed if the image path is relevant to media storage.<br/>
32         /// The externalstorage privilege (http://tizen.org/privilege/externalstorage) is needed if the image path is relevant to external storage.
33         /// </remarks>
34         /// <param name="size">The <see cref="Size"/> of the generated image.</param>
35         /// <param name="path">The path to the file to be generated.</param>
36         /// <param name="imageFormat">The format of the output image.</param>
37         /// <exception cref="ArgumentOutOfRangeException">
38         ///     The width of <paramref name="size"/> is less than or equal to zero.<br/>
39         ///     -or-<br/>
40         ///     The height of <paramref name="size"/> is less than or equal to zero.
41         /// </exception>
42         /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
43         /// <exception cref="ArgumentException"><paramref name="imageFormat"/> is invalid.</exception>
44         /// <example>
45         /// <code>
46         /// var imageConfig = new BarcodeImageConfiguration(new Size(500, 400), "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
47         /// </code>
48         /// </example>
49         /// <since_tizen> 4 </since_tizen>
50         public BarcodeImageConfiguration(Size size, string path, BarcodeImageFormat imageFormat)
51         {
52             if (size.Width <= 0)
53             {
54                 throw new ArgumentOutOfRangeException(nameof(Size.Width), size.Width,
55                     "width can't be less than or equal to zero.");
56             }
57
58             if (size.Height <= 0)
59             {
60                 throw new ArgumentOutOfRangeException(nameof(Size.Height), size.Height,
61                     "height can't be less than or equal to zero.");
62             }
63
64             if (path == null)
65             {
66                 throw new ArgumentNullException(nameof(path));
67             }
68
69             ValidationUtil.ValidateEnum(typeof(BarcodeImageFormat), imageFormat, nameof(imageFormat));
70
71             Size = size;
72             Path = path;
73             Format = imageFormat;
74         }
75
76         /// <summary>
77         /// Initializes a new instance of the <see cref="BarcodeImageConfiguration"/> class.
78         /// </summary>
79         /// <remarks>
80         /// The mediastorage privilege (http://tizen.org/privilege/mediastorage) is needed if the image path is relevant to media storage.<br/>
81         /// The externalstorage privilege (http://tizen.org/privilege/externalstorage) is needed if the image path is relevant to external storage.
82         /// </remarks>
83         /// <param name="width">The width of the image to be generated.</param>
84         /// <param name="height">The height of the image to be generated.</param>
85         /// <param name="path">The path to the file to be generated.</param>
86         /// <param name="imageFormat">The format of the output image.</param>
87         /// <exception cref="ArgumentOutOfRangeException">
88         ///     <paramref name="width"/> is less than or equal to zero.<br/>
89         ///     -or-<br/>
90         ///     <paramref name="height"/> is less than or equal to zero.
91         /// </exception>
92         /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
93         /// <exception cref="ArgumentException"><paramref name="imageFormat"/> is invalid.</exception>
94         /// <example>
95         /// <code>
96         /// var imageConfig = new BarcodeImageConfiguration(500, 400, "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
97         /// </code>
98         /// </example>
99         /// <since_tizen> 4 </since_tizen>
100         public BarcodeImageConfiguration(int width, int height, string path, BarcodeImageFormat imageFormat)
101             : this(new Size(width, height), path, imageFormat)
102         {
103         }
104
105         /// <summary>
106         /// Gets the size of the image.
107         /// </summary>
108         /// <since_tizen> 4 </since_tizen>
109         public Size Size { get; }
110
111         /// <summary>
112         /// Gets the width of the image.
113         /// </summary>
114         /// <since_tizen> 4 </since_tizen>
115         public int Width => Size.Width;
116
117         /// <summary>
118         /// Gets the height of the image.
119         /// </summary>
120         /// <since_tizen> 4 </since_tizen>
121         public int Height => Size.Height;
122
123         /// <summary>
124         /// Gets the path to the file that has to be generated.
125         /// </summary>
126         /// <remarks>
127         /// The mediastorage privilege (http://tizen.org/privilege/mediastorage) is needed if the image path is relevant to media storage.<br/>
128         /// The externalstorage privilege (http://tizen.org/privilege/externalstorage) is needed if the image path is relevant to external storage.
129         /// </remarks>
130         /// <since_tizen> 4 </since_tizen>
131         public string Path { get; }
132
133         /// <summary>
134         /// Gets the format of the output image.
135         /// </summary>
136         /// <since_tizen> 4 </since_tizen>
137         public BarcodeImageFormat Format { get; }
138     }
139 }