2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 namespace Tizen.Multimedia.Vision
22 /// Represents a configuration for the image to be generated by <see cref="BarcodeGenerator"/>.
24 /// <since_tizen> 3 </since_tizen>
25 public class BarcodeImageConfiguration
28 /// Initializes a new instance of the <see cref="BarcodeImageConfiguration"/> class.
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.
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/>
40 /// The height of <paramref name="size"/> is less than or equal to zero.
42 /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
43 /// <exception cref="ArgumentException"><paramref name="imageFormat"/> is invalid.</exception>
46 /// var imageConfig = new BarcodeImageConfiguration(new Size(500, 400), "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
49 /// <since_tizen> 3 </since_tizen>
50 public BarcodeImageConfiguration(Size size, string path, BarcodeImageFormat imageFormat)
54 throw new ArgumentOutOfRangeException(nameof(Size.Width), size.Width,
55 "width can't be less than or equal to zero.");
60 throw new ArgumentOutOfRangeException(nameof(Size.Height), size.Height,
61 "height can't be less than or equal to zero.");
66 throw new ArgumentNullException(nameof(path));
69 ValidationUtil.ValidateEnum(typeof(BarcodeImageFormat), imageFormat);
77 /// Initializes a new instance of the <see cref="BarcodeImageConfiguration"/> class.
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.
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/>
90 /// <paramref name="height"/> is less than or equal to zero.
92 /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
93 /// <exception cref="ArgumentException"><paramref name="imageFormat"/> is invalid.</exception>
96 /// var imageConfig = new BarcodeImageConfiguration(500, 400, "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
99 /// <since_tizen> 3 </since_tizen>
100 public BarcodeImageConfiguration(int width, int height, string path, BarcodeImageFormat imageFormat)
101 : this(new Size(width, height), path, imageFormat)
106 /// Gets the size of the image.
108 /// <since_tizen> 3 </since_tizen>
109 public Size Size { get; }
112 /// Gets the width of the image.
114 /// <since_tizen> 3 </since_tizen>
115 public int Width => Size.Width;
118 /// Gets the height of the image.
120 /// <since_tizen> 3 </since_tizen>
121 public int Height => Size.Height;
124 /// Gets the path to the file that has to be generated.
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.
130 /// <since_tizen> 3 </since_tizen>
131 public string Path { get; }
134 /// Gets the format of the output image.
136 /// <since_tizen> 3 </since_tizen>
137 public BarcodeImageFormat Format { get; }