2 * Copyright 2008 ZXing authors
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 using ByteMatrix = com.google.zxing.common.ByteMatrix;
\r
18 using EAN13Writer = com.google.zxing.oned.EAN13Writer;
\r
19 using EAN8Writer = com.google.zxing.oned.EAN8Writer;
\r
20 using QRCodeWriter = com.google.zxing.qrcode.QRCodeWriter;
\r
21 namespace com.google.zxing
\r
24 /// <summary> This is a factory class which finds the appropriate Writer subclass for the BarcodeFormat
\r
25 /// requested and encodes the barcode with the supplied contents.
\r
28 /// <author> dswitkin@google.com (Daniel Switkin)
\r
30 /// <author>www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source
\r
33 public sealed class MultiFormatWriter : Writer
\r
36 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height)
\r
39 return encode(contents, format, width, height, null);
\r
42 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Hashtable hints)
\r
45 if (format == BarcodeFormat.EAN_8)
\r
47 return new EAN8Writer().encode(contents, format, width, height, hints);
\r
49 else if (format == BarcodeFormat.EAN_13)
\r
51 return new EAN13Writer().encode(contents, format, width, height, hints);
\r
53 else if (format == BarcodeFormat.QR_CODE)
\r
55 return new QRCodeWriter().encode(contents, format, width, height, hints);
\r
59 throw new System.ArgumentException("No encoder available for format " + format);
\r