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