Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / src / fxbarcode / src / include / BC_QRCoderMatrixUtil.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _BC_QRCODERMATRIXUTIL_H_\r
8 #define _BC_QRCODERMATRIXUTIL_H_\r
9 class CBC_CommonByteMatrix;\r
10 class CBC_QRCoderErrorCorrectionLevel;\r
11 class CBC_QRCoderBitVector;\r
12 class CBC_QRCoderMatrixUtil;\r
13 class CBC_QRCoderMatrixUtil  : public CFX_Object\r
14 {\r
15 private:\r
16     const static FX_INT32 POSITION_DETECTION_PATTERN[7][7];\r
17     const static FX_INT32 VERTICAL_SEPARATION_PATTERN[7][1];\r
18     const static FX_INT32 HORIZONTAL_SEPARATION_PATTERN[1][8];\r
19     const static FX_INT32 POSITION_ADJUSTMENT_PATTERN[5][5];\r
20     const static FX_INT32 POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7];\r
21     const static FX_INT32 TYPE_INFO_COORDINATES[15][2];\r
22     const static FX_INT32 VERSION_INFO_POLY;\r
23     const static FX_INT32 TYPE_INFO_POLY;\r
24     const static FX_INT32 TYPE_INFO_MASK_PATTERN;\r
25 public:\r
26     CBC_QRCoderMatrixUtil();\r
27     virtual ~CBC_QRCoderMatrixUtil();\r
28     static void ClearMatrix(CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
29     static void BuildMatrix(CBC_QRCoderBitVector* dataBits, CBC_QRCoderErrorCorrectionLevel* ecLevel,\r
30                             FX_INT32 version, FX_INT32 maskPattern, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
31     static void EmbedBasicPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
32     static void EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 maskPattern, CBC_CommonByteMatrix *matrix, FX_INT32 &e);\r
33     static void EmbedDataBits(CBC_QRCoderBitVector* dataBits, FX_INT32 maskPattern, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
34     static void MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
35     static FX_INT32 FindMSBSet(FX_INT32 value);\r
36     static FX_INT32 CalculateBCHCode(FX_INT32 code, FX_INT32 poly);\r
37     static void MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 maskPattern, CBC_QRCoderBitVector* bits, FX_INT32 &e);\r
38     static void MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBitVector* bits, FX_INT32 &e);\r
39     static FX_BOOL IsEmpty(FX_INT32 value);\r
40     static FX_BOOL IsValidValue(FX_INT32 value);\r
41     static void EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
42     static void EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
43     static void EmbedHorizontalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
44     static void EmbedVerticalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
45     static void EmbedPositionAdjustmentPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
46     static void EmbedPositionDetectionPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
47     static void EmbedPositionDetectionPatternsAndSeparators(CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
48     static void MaybeEmbedPositionAdjustmentPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
49 };\r
50 #endif\r