[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Vision / MediaVision / BarcodeGenerationConfiguration.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 Tizen.Common;
19
20 namespace Tizen.Multimedia.Vision
21 {
22     /// <summary>
23     /// Represents a configuration of <see cref="BarcodeGenerator"/> instances.
24     /// </summary>
25     /// <seealso cref="BarcodeGenerator"/>
26     /// <since_tizen> 4 </since_tizen>
27     public class BarcodeGenerationConfiguration : EngineConfiguration
28     {
29         private const string KeyTextAttr = "MV_BARCODE_GENERATE_ATTR_TEXT";
30         private const string KeyForegroundColorAttr = "MV_BARCODE_GENERATE_ATTR_COLOR_FRONT";
31         private const string KeyBackgroundColorAttr = "MV_BARCODE_GENERATE_ATTR_COLOR_BACK";
32
33         /// <summary>
34         /// Initializes a new instance of the <see cref="BarcodeGenerationConfiguration"/> class.
35         /// </summary>
36         /// <exception cref="NotSupportedException">The feature is not supported.</exception>
37         /// <since_tizen> 4 </since_tizen>
38         public BarcodeGenerationConfiguration() : base("barcode_generation")
39         {
40         }
41
42         /// <summary>
43         /// Gets or sets the text visibility of the barcode to be generated.
44         /// </summary>
45         /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
46         /// <exception cref="ObjectDisposedException">The <see cref="BarcodeGenerationConfiguration"/> already has been disposed of.</exception>
47         /// <since_tizen> 4 </since_tizen>
48         public Visibility TextVisibility
49         {
50             get
51             {
52                 return (Visibility)GetInt(KeyTextAttr);
53             }
54             set
55             {
56                 ValidationUtil.ValidateEnum(typeof(Visibility), value, nameof(value));
57
58                 Set(KeyTextAttr, (int)value);
59             }
60         }
61
62         private Color _foregroundColor = Color.Black;
63
64         /// <summary>
65         /// Gets or sets the foreground color of the barcode to be generated.
66         /// </summary>
67         /// <remarks>
68         /// The alpha value of the color will be ignored.
69         /// </remarks>
70         /// <exception cref="ObjectDisposedException">The <see cref="BarcodeGenerationConfiguration"/> already has been disposed of.</exception>
71         /// <since_tizen> 4 </since_tizen>
72         public Color ForegroundColor
73         {
74             get
75             {
76                 return _foregroundColor;
77             }
78             set
79             {
80                 Set(KeyForegroundColorAttr, string.Format("{0:x2}{1:x2}{2:x2}", value.R, value.G, value.B));
81                 _foregroundColor = value;
82             }
83         }
84
85         private Color _backgroundColor = Color.White;
86
87         /// <summary>
88         /// Gets or sets the background color of the barcode to be generated.
89         /// </summary>
90         /// <remarks>
91         /// The alpha value of the color will be ignored.
92         /// </remarks>
93         /// <exception cref="ObjectDisposedException">The <see cref="BarcodeGenerationConfiguration"/> already has been disposed of.</exception>
94         /// <since_tizen> 4 </since_tizen>
95         public Color BackgroundColor
96         {
97             get
98             {
99                 return _backgroundColor;
100             }
101             set
102             {
103                 Set(KeyBackgroundColorAttr, string.Format("{0:x2}{1:x2}{2:x2}", value.R, value.G, value.B));
104                 _backgroundColor = value;
105             }
106         }
107     }
108 }