[NUI] Add GenerateUrl in Capture
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Vision / MediaVision / QrConfiguration.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 using System.ComponentModel;
19
20 namespace Tizen.Multimedia.Vision
21 {
22     /// <summary>
23     /// Represents a QR configuration of <see cref="BarcodeGenerator"/>.
24     /// </summary>
25     /// <since_tizen> 4 </since_tizen>
26     public class QrConfiguration
27     {
28         private string _embedImagePath;
29         private QrShape _dataShape = QrShape.Rectangular;
30         private QrShape _finderShape = QrShape.Rectangular;
31
32         /// <summary>
33         /// Initializes a new instance of the <see cref="QrConfiguration"/> class.
34         /// </summary>
35         /// <param name="qrMode">Encoding mode for the message.</param>
36         /// <param name="ecc">Error correction level.</param>
37         /// <param name="version">QR code version. From 1 to 40 inclusive.</param>
38         /// <exception cref="ArgumentOutOfRangeException">
39         ///     <paramref name="version"/> is less than 1.<br/>
40         ///     -or-<br/>
41         ///     <paramref name="version"/> is greater than 40.
42         /// </exception>
43         /// <exception cref="ArgumentException">
44         ///     <paramref name="qrMode"/> is invalid.<br/>
45         ///     -or-<br/>
46         ///     <paramref name="ecc"/> is invalid.
47         /// </exception>
48         /// <example>
49         /// <code>
50         /// var qrConfig = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
51         /// </code>
52         /// </example>
53         /// <since_tizen> 4 </since_tizen>
54         public QrConfiguration(QrMode qrMode, ErrorCorrectionLevel ecc, int version)
55         {
56             if (version < 1 || version > 40)
57             {
58                 throw new ArgumentOutOfRangeException(nameof(version), version,
59                     "Valid version range is 1 to 40 inclusive.");
60             }
61             ValidationUtil.ValidateEnum(typeof(QrMode), qrMode, nameof(qrMode));
62             ValidationUtil.ValidateEnum(typeof(ErrorCorrectionLevel), ecc, nameof(ecc));
63
64             Mode = qrMode;
65             ErrorCorrectionLevel = ecc;
66             Version = version;
67         }
68
69         /// <summary>
70         /// Gets the encoding mode for the message.
71         /// </summary>
72         /// <since_tizen> 4 </since_tizen>
73         public QrMode Mode { get; }
74
75         /// <summary>
76         /// Gets the error correction level.
77         /// </summary>
78         /// <since_tizen> 4 </since_tizen>
79         public ErrorCorrectionLevel ErrorCorrectionLevel { get; }
80
81         /// <summary>
82         /// Gets the QR code version.
83         /// </summary>
84         /// <since_tizen> 4 </since_tizen>
85         public int Version { get; }
86
87         /// <summary>
88         /// Gets or sets the embed image absolute path of the Design QR code.
89         /// </summary>
90         /// <remarks>
91         /// The mediastorage privilege (http://tizen.org/privilege/mediastorage) is needed if the image path is relevant to media storage.<br/>
92         /// The externalstorage privilege (http://tizen.org/privilege/externalstorage) is needed if the image path is relevant to external storage.
93         /// </remarks>
94         /// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception>
95         /// <exception cref="ArgumentException"><paramref name="value"/> is zero-length string.</exception>
96         [EditorBrowsable(EditorBrowsableState.Never)]
97         public string EmbedImagePath
98         {
99             get
100             {
101                 return _embedImagePath;
102             }
103             set
104             {
105                 ValidationUtil.ValidateIsNullOrEmpty(value, nameof(value));
106
107                 _embedImagePath = value;
108             }
109         }
110
111         /// <summary>
112         /// Gets or sets the data shape of the Design QR code.
113         /// </summary>
114         /// <remarks>The default value is <see cref="QrShape.Rectangular"/>.</remarks>
115         /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
116         [EditorBrowsable(EditorBrowsableState.Never)]
117         public QrShape DataShape
118         {
119             get
120             {
121                 return _dataShape;
122             }
123             set
124             {
125                 ValidationUtil.ValidateEnum(typeof(QrShape), value, nameof(value));
126
127                 _dataShape = value;
128             }
129         }
130
131         /// <summary>
132         /// Gets or sets the finder shape of the Design QR code.
133         /// </summary>
134         /// <remarks>The default value is <see cref="QrShape.Rectangular"/>.</remarks>
135         /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
136         [EditorBrowsable(EditorBrowsableState.Never)]
137         public QrShape FinderShape
138         {
139             get
140             {
141                 return _finderShape;
142             }
143             set
144             {
145                 ValidationUtil.ValidateEnum(typeof(QrShape), value, nameof(value));
146
147                 _finderShape = value;
148             }
149         }
150     }
151 }