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
22 /// Represents a configuration for the image to be generated by <see cref="BarcodeGenerator"/>.
24 public class BarcodeImageConfiguration
27 /// Initializes a new instance of the <see cref="BarcodeImageConfiguration"/> class.
30 /// The mediastorage privilege(http://tizen.org/privilege/mediastorage) is needed if image path is relevant to media storage.\n
31 /// The externalstorage privilege(http://tizen.org/privilege/externalstorage) is needed if image path is relevant to external storage.
33 /// <param name="size">The <see cref="Size"/> of the generated image.</param>
34 /// <param name="path">The path to the file to be generated.</param>
35 /// <param name="imageFormat">The format of the output image.</param>
36 /// <exception cref="ArgumentOutOfRangeException">
37 /// The width of <paramref name="size"/> is less than or equal to zero.\n
39 /// The height of <paramref name="size"/> is less than or equal to zero.
41 /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
42 /// <exception cref="ArgumentException"><paramref name="imageFormat"/> is invalid.</exception>
44 /// BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration(new Size(500, 400), "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
46 public BarcodeImageConfiguration(Size size, string path, BarcodeImageFormat imageFormat)
50 throw new ArgumentOutOfRangeException(nameof(Size.Width), size.Width,
51 "width can't be less than or equal to zero.");
56 throw new ArgumentOutOfRangeException(nameof(Size.Height), size.Height,
57 "height can't be less than or equal to zero.");
62 throw new ArgumentNullException(nameof(path));
65 ValidationUtil.ValidateEnum(typeof(BarcodeImageFormat), imageFormat);
73 /// Initializes a new instance of the <see cref="BarcodeImageConfiguration"/> class.
76 /// The mediastorage privilege(http://tizen.org/privilege/mediastorage) is needed if image path is relevant to media storage.\n
77 /// The externalstorage privilege(http://tizen.org/privilege/externalstorage) is needed if image path is relevant to external storage.
79 /// <param name="width">The width of the image to be generated.</param>
80 /// <param name="height">The height of the image to be generated.</param>
81 /// <param name="path">The path to the file to be generated.</param>
82 /// <param name="imageFormat">The format of the output image.</param>
83 /// <exception cref="ArgumentOutOfRangeException">
84 /// <paramref name="width"/> is less than or equal to zero.\n
86 /// <paramref name="height"/> is less than or equal to zero.
88 /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
89 /// <exception cref="ArgumentException"><paramref name="imageFormat"/> is invalid.</exception>
91 /// BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration(500, 400, "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
93 public BarcodeImageConfiguration(int width, int height, string path, BarcodeImageFormat imageFormat)
94 : this(new Size(width, height), path, imageFormat)
99 /// Gets the size of the image.
101 public Size Size { get; }
104 /// Gets the width of the image.
106 public int Width => Size.Width;
109 /// Gets the height of the image.
111 public int Height => Size.Height;
114 /// Gets the path to the file that has to be generated
117 /// The mediastorage privilege http://tizen.org/privilege/mediastorage is needed if image path is relevant to media storage.\n
118 /// The externalstorage privilege http://tizen.org/privilege/externalstorage is needed if image path is relevant to external storage.
120 public string Path { get; }
123 /// Gets the format of the output image
125 public BarcodeImageFormat Format { get; }