/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
namespace Tizen.Multimedia.Vision
{
///
/// Represents a configuration for the image to be generated by .
///
/// 3
public class BarcodeImageConfiguration
{
///
/// Initializes a new instance of the class.
///
///
/// The mediastorage privilege (http://tizen.org/privilege/mediastorage) is needed if the image path is relevant to media storage.
/// The externalstorage privilege (http://tizen.org/privilege/externalstorage) is needed if the image path is relevant to external storage.
///
/// The of the generated image.
/// The path to the file to be generated.
/// The format of the output image.
///
/// The width of is less than or equal to zero.
/// -or-
/// The height of is less than or equal to zero.
///
/// is null.
/// is invalid.
///
/// BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration(new Size(500, 400), "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
///
/// 3
public BarcodeImageConfiguration(Size size, string path, BarcodeImageFormat imageFormat)
{
if (size.Width <= 0)
{
throw new ArgumentOutOfRangeException(nameof(Size.Width), size.Width,
"width can't be less than or equal to zero.");
}
if (size.Height <= 0)
{
throw new ArgumentOutOfRangeException(nameof(Size.Height), size.Height,
"height can't be less than or equal to zero.");
}
if (path == null)
{
throw new ArgumentNullException(nameof(path));
}
ValidationUtil.ValidateEnum(typeof(BarcodeImageFormat), imageFormat);
Size = size;
Path = path;
Format = imageFormat;
}
///
/// Initializes a new instance of the class.
///
///
/// The mediastorage privilege (http://tizen.org/privilege/mediastorage) is needed if the image path is relevant to media storage.
/// The externalstorage privilege (http://tizen.org/privilege/externalstorage) is needed if the image path is relevant to external storage.
///
/// The width of the image to be generated.
/// The height of the image to be generated.
/// The path to the file to be generated.
/// The format of the output image.
///
/// is less than or equal to zero.
/// -or-
/// is less than or equal to zero.
///
/// is null.
/// is invalid.
///
/// BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration(500, 400, "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG);
///
/// 3
public BarcodeImageConfiguration(int width, int height, string path, BarcodeImageFormat imageFormat)
: this(new Size(width, height), path, imageFormat)
{
}
///
/// Gets the size of the image.
///
/// 3
public Size Size { get; }
///
/// Gets the width of the image.
///
/// 3
public int Width => Size.Width;
///
/// Gets the height of the image.
///
/// 3
public int Height => Size.Height;
///
/// Gets the path to the file that has to be generated.
///
///
/// The mediastorage privilege (http://tizen.org/privilege/mediastorage) is needed if the image path is relevant to media storage.
/// The externalstorage privilege (http://tizen.org/privilege/externalstorage) is needed if the image path is relevant to external storage.
///
/// 3
public string Path { get; }
///
/// Gets the format of the output image.
///
/// 3
public BarcodeImageFormat Format { get; }
}
}