]> Pileus Git - ~andy/freeotp/blob - src/com/google/zxing/qrcode/decoder/QRCodeDecoderMetaData.java
Add native camera support
[~andy/freeotp] / src / com / google / zxing / qrcode / decoder / QRCodeDecoderMetaData.java
1 /*
2  * Copyright 2013 ZXing authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package com.google.zxing.qrcode.decoder;
18
19 import com.google.zxing.ResultPoint;
20
21 /**
22  * Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the
23  * decoding caller. Callers are expected to process this.
24  * 
25  * @see com.google.zxing.common.DecoderResult#getOther()
26  */
27 public final class QRCodeDecoderMetaData {
28
29   private final boolean mirrored;
30   
31   QRCodeDecoderMetaData(boolean mirrored) {
32     this.mirrored = mirrored;
33   }
34
35   /** 
36    * @return true if the QR Code was mirrored. 
37    */
38   public boolean isMirrored() {
39     return mirrored;
40   }
41
42   /**
43    * Apply the result points' order correction due to mirroring.
44    * 
45    * @param points Array of points to apply mirror correction to.
46    */
47   public void applyMirroredCorrection(ResultPoint[] points) {
48     if (!mirrored || points == null || points.length < 3) {
49       return;
50     }
51     ResultPoint bottomLeft = points[0];
52     points[0] = points[2];
53     points[2] = bottomLeft;
54     // No need to 'fix' top-left and alignment pattern.
55   }
56
57 }