/* * Copyright 2012 ZXing.Net authors * * 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; using System.Collections.Generic; using System.ComponentModel; namespace ZXing.Common { /// /// Defines an container for encoder options /// [Serializable] public class EncodingOptions { /// /// Gets the data container for all options /// [Browsable(false)] public IDictionary Hints { get; private set; } /// /// Specifies the height of the barcode image /// public int Height { get { if (Hints.ContainsKey(EncodeHintType.HEIGHT)) { return (int)Hints[EncodeHintType.HEIGHT]; } return 0; } set { Hints[EncodeHintType.HEIGHT] = value; } } /// /// Specifies the width of the barcode image /// public int Width { get { if (Hints.ContainsKey(EncodeHintType.WIDTH)) { return (int)Hints[EncodeHintType.WIDTH]; } return 0; } set { Hints[EncodeHintType.WIDTH] = value; } } /// /// Don't put the content string into the output image. /// public bool PureBarcode { get { if (Hints.ContainsKey(EncodeHintType.PURE_BARCODE)) { return (bool)Hints[EncodeHintType.PURE_BARCODE]; } return false; } set { Hints[EncodeHintType.PURE_BARCODE] = value; } } /// /// Specifies margin, in pixels, to use when generating the barcode. The meaning can vary /// by format; for example it controls margin before and after the barcode horizontally for /// most 1D formats. /// public int Margin { get { if (Hints.ContainsKey(EncodeHintType.MARGIN)) { return (int) Hints[EncodeHintType.MARGIN]; } return 0; } set { Hints[EncodeHintType.MARGIN] = value; } } /// /// Initializes a new instance of the class. /// public EncodingOptions() { Hints = new Dictionary(); } } }