"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/oned/rss/RSS14Reader.java" between
zxing-zxing-3.4.1.tar.gz and zxing-zxing-3.5.0.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. Info: Project is in maintenance mode (no active development).

RSS14Reader.java  (zxing-zxing-3.4.1):RSS14Reader.java  (zxing-zxing-3.5.0)
skipping to change at line 23 skipping to change at line 23
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.zxing.oned.rss; package com.google.zxing.oned.rss;
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType; import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException; import com.google.zxing.NotFoundException;
import com.google.zxing.Result; import com.google.zxing.Result;
import com.google.zxing.ResultMetadataType;
import com.google.zxing.ResultPoint; import com.google.zxing.ResultPoint;
import com.google.zxing.ResultPointCallback; import com.google.zxing.ResultPointCallback;
import com.google.zxing.common.BitArray; import com.google.zxing.common.BitArray;
import com.google.zxing.common.detector.MathUtils; import com.google.zxing.common.detector.MathUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
skipping to change at line 134 skipping to change at line 135
checkDigit += (i & 0x01) == 0 ? 3 * digit : digit; checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
} }
checkDigit = 10 - (checkDigit % 10); checkDigit = 10 - (checkDigit % 10);
if (checkDigit == 10) { if (checkDigit == 10) {
checkDigit = 0; checkDigit = 0;
} }
buffer.append(checkDigit); buffer.append(checkDigit);
ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints(); ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints(); ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
return new Result( Result result = new Result(
buffer.toString(), buffer.toString(),
null, null,
new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightP oints[1], }, new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightP oints[1], },
BarcodeFormat.RSS_14); BarcodeFormat.RSS_14);
result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]e0");
return result;
} }
private static boolean checkChecksum(Pair leftPair, Pair rightPair) { private static boolean checkChecksum(Pair leftPair, Pair rightPair) {
//int leftFPValue = leftPair.getFinderPattern().getValue();
//int rightFPValue = rightPair.getFinderPattern().getValue();
//if ((leftFPValue == 0 && rightFPValue == 8) ||
// (leftFPValue == 8 && rightFPValue == 0)) {
//}
int checkValue = (leftPair.getChecksumPortion() + 16 * rightPair.getChecksum Portion()) % 79; int checkValue = (leftPair.getChecksumPortion() + 16 * rightPair.getChecksum Portion()) % 79;
int targetCheckValue = int targetCheckValue =
9 * leftPair.getFinderPattern().getValue() + rightPair.getFinderPattern( ).getValue(); 9 * leftPair.getFinderPattern().getValue() + rightPair.getFinderPattern( ).getValue();
if (targetCheckValue > 72) { if (targetCheckValue > 72) {
targetCheckValue--; targetCheckValue--;
} }
if (targetCheckValue > 8) { if (targetCheckValue > 8) {
targetCheckValue--; targetCheckValue--;
} }
return checkValue == targetCheckValue; return checkValue == targetCheckValue;
} }
private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<Decode HintType,?> hints) { private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<Decode HintType,?> hints) {
try { try {
int[] startEnd = findFinderPattern(row, right); int[] startEnd = findFinderPattern(row, right);
FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, sta rtEnd); FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, sta rtEnd);
ResultPointCallback resultPointCallback = hints == null ? null : ResultPointCallback resultPointCallback = hints == null ? null :
(ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBAC K); (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLB ACK);
if (resultPointCallback != null) { if (resultPointCallback != null) {
startEnd = pattern.getStartEnd(); startEnd = pattern.getStartEnd();
float center = (startEnd[0] + startEnd[1] - 1) / 2.0f; float center = (startEnd[0] + startEnd[1] - 1) / 2.0f;
if (right) { if (right) {
// row is actually reversed // row is actually reversed
center = row.getSize() - 1 - center; center = row.getSize() - 1 - center;
} }
resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, row Number)); resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, row Number));
} }
 End of changes. 5 change blocks. 
7 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)