2 * Copyright 2007 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 ResultPoint = com.google.zxing.ResultPoint;
\r
18 namespace com.google.zxing.qrcode.detector
\r
21 /// <summary> <p>Encapsulates a finder pattern, which are the three square patterns found in
\r
22 /// the corners of QR Codes. It also encapsulates a count of similar finder patterns,
\r
23 /// as a convenience to the finder's bookkeeping.</p>
\r
26 /// <author> Sean Owen
\r
28 /// <author>www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source
\r
30 public sealed class FinderPattern:ResultPoint
\r
32 public float EstimatedModuleSize
\r
36 return estimatedModuleSize;
\r
49 //UPGRADE_NOTE: Final was removed from the declaration of 'estimatedModuleSize '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
\r
50 private float estimatedModuleSize;
\r
53 internal FinderPattern(float posX, float posY, float estimatedModuleSize):base(posX, posY)
\r
55 this.estimatedModuleSize = estimatedModuleSize;
\r
59 internal void incrementCount()
\r
64 /// <summary> <p>Determines if this finder pattern "about equals" a finder pattern at the stated
\r
65 /// position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
\r
67 internal bool aboutEquals(float moduleSize, float i, float j)
\r
69 if (System.Math.Abs(i - Y) <= moduleSize && System.Math.Abs(j - X) <= moduleSize)
\r
71 float moduleSizeDiff = System.Math.Abs(moduleSize - estimatedModuleSize);
\r
72 return moduleSizeDiff <= 1.0f || moduleSizeDiff / estimatedModuleSize <= 1.0f;
\r