Korean translation from Chang Hyun Park
[zxing.git] / csharp / MultiFormatWriter.cs
1 /*\r
2 * Copyright 2008 ZXing authors\r
3 *\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
7 *\r
8 *      http://www.apache.org/licenses/LICENSE-2.0\r
9 *\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
15 */\r
16 using System;\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
22 {\r
23         \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
26         /// \r
27         /// </summary>\r
28         /// <author>  dswitkin@google.com (Daniel Switkin)\r
29         /// </author>\r
30         /// <author>www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source \r
31         /// </author>\r
32 \r
33         public sealed class MultiFormatWriter : Writer\r
34         {\r
35                 \r
36                 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height)\r
37                 {\r
38                         \r
39                         return encode(contents, format, width, height, null);\r
40                 }\r
41                 \r
42                 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Hashtable hints)\r
43                 {\r
44                         \r
45                         if (format == BarcodeFormat.EAN_8)\r
46                         {\r
47                                 return new EAN8Writer().encode(contents, format, width, height, hints);\r
48                         }\r
49                         else if (format == BarcodeFormat.EAN_13)\r
50                         {\r
51                                 return new EAN13Writer().encode(contents, format, width, height, hints);\r
52                         }\r
53                         else if (format == BarcodeFormat.QR_CODE)\r
54                         {\r
55                                 return new QRCodeWriter().encode(contents, format, width, height, hints);\r
56                         }\r
57                         else\r
58                         {\r
59                                 throw new System.ArgumentException("No encoder available for format " + format);\r
60                         }\r
61                 }\r
62         }\r
63 }