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 image path is relevant to media storage.\n
32 /// The externalstorage privilege(http://tizen.org/privilege/externalstorage) is needed if 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.\n
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>
45 /// BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration(new Size(500, 400), "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
47 /// <since_tizen> 3</since_tizen>
48 public BarcodeImageConfiguration(Size size, string path, BarcodeImageFormat imageFormat)
52 throw new ArgumentOutOfRangeException(nameof(Size.Width), size.Width,
53 "width can't be less than or equal to zero.");
58 throw new ArgumentOutOfRangeException(nameof(Size.Height), size.Height,
59 "height can't be less than or equal to zero.");
64 throw new ArgumentNullException(nameof(path));
67 ValidationUtil.ValidateEnum(typeof(BarcodeImageFormat), imageFormat);
75 /// Initializes a new instance of the <see cref="BarcodeImageConfiguration"/> class.
78 /// The mediastorage privilege(http://tizen.org/privilege/mediastorage) is needed if image path is relevant to media storage.\n
79 /// The externalstorage privilege(http://tizen.org/privilege/externalstorage) is needed if image path is relevant to external storage.
81 /// <param name="width">The width of the image to be generated.</param>
82 /// <param name="height">The height of the image to be generated.</param>
83 /// <param name="path">The path to the file to be generated.</param>
84 /// <param name="imageFormat">The format of the output image.</param>
85 /// <exception cref="ArgumentOutOfRangeException">
86 /// <paramref name="width"/> is less than or equal to zero.\n
88 /// <paramref name="height"/> is less than or equal to zero.
90 /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
91 /// <exception cref="ArgumentException"><paramref name="imageFormat"/> is invalid.</exception>
93 /// BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration(500, 400, "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
95 /// <since_tizen> 3</since_tizen>
96 public BarcodeImageConfiguration(int width, int height, string path, BarcodeImageFormat imageFormat)
97 : this(new Size(width, height), path, imageFormat)
102 /// Gets the size of the image.
104 /// <since_tizen> 3</since_tizen>
105 public Size Size { get; }
108 /// Gets the width of the image.
110 /// <since_tizen> 3</since_tizen>
111 public int Width => Size.Width;
114 /// Gets the height of the image.
116 /// <since_tizen> 3</since_tizen>
117 public int Height => Size.Height;
120 /// Gets the path to the file that has to be generated.
123 /// The mediastorage privilege http://tizen.org/privilege/mediastorage is needed if image path is relevant to media storage.\n
124 /// The externalstorage privilege http://tizen.org/privilege/externalstorage is needed if image path is relevant to external storage.
126 /// <since_tizen> 3</since_tizen>
127 public string Path { get; }
130 /// Gets the format of the output image.
132 /// <since_tizen> 3</since_tizen>
133 public BarcodeImageFormat Format { get; }