mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
move all Result to RXingResult
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
package com.google.zxing.pdf417.decoder;
|
||||
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.RXingResultPoint;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
|
||||
/**
|
||||
@@ -26,31 +26,31 @@ import com.google.zxing.common.BitMatrix;
|
||||
final class BoundingBox {
|
||||
|
||||
private final BitMatrix image;
|
||||
private final ResultPoint topLeft;
|
||||
private final ResultPoint bottomLeft;
|
||||
private final ResultPoint topRight;
|
||||
private final ResultPoint bottomRight;
|
||||
private final RXingResultPoint topLeft;
|
||||
private final RXingResultPoint bottomLeft;
|
||||
private final RXingResultPoint topRight;
|
||||
private final RXingResultPoint bottomRight;
|
||||
private final int minX;
|
||||
private final int maxX;
|
||||
private final int minY;
|
||||
private final int maxY;
|
||||
|
||||
BoundingBox(BitMatrix image,
|
||||
ResultPoint topLeft,
|
||||
ResultPoint bottomLeft,
|
||||
ResultPoint topRight,
|
||||
ResultPoint bottomRight) throws NotFoundException {
|
||||
RXingResultPoint topLeft,
|
||||
RXingResultPoint bottomLeft,
|
||||
RXingResultPoint topRight,
|
||||
RXingResultPoint bottomRight) throws NotFoundException {
|
||||
boolean leftUnspecified = topLeft == null || bottomLeft == null;
|
||||
boolean rightUnspecified = topRight == null || bottomRight == null;
|
||||
if (leftUnspecified && rightUnspecified) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
if (leftUnspecified) {
|
||||
topLeft = new ResultPoint(0, topRight.getY());
|
||||
bottomLeft = new ResultPoint(0, bottomRight.getY());
|
||||
topLeft = new RXingResultPoint(0, topRight.getY());
|
||||
bottomLeft = new RXingResultPoint(0, bottomRight.getY());
|
||||
} else if (rightUnspecified) {
|
||||
topRight = new ResultPoint(image.getWidth() - 1, topLeft.getY());
|
||||
bottomRight = new ResultPoint(image.getWidth() - 1, bottomLeft.getY());
|
||||
topRight = new RXingResultPoint(image.getWidth() - 1, topLeft.getY());
|
||||
bottomRight = new RXingResultPoint(image.getWidth() - 1, bottomLeft.getY());
|
||||
}
|
||||
this.image = image;
|
||||
this.topLeft = topLeft;
|
||||
@@ -86,18 +86,18 @@ final class BoundingBox {
|
||||
}
|
||||
|
||||
BoundingBox addMissingRows(int missingStartRows, int missingEndRows, boolean isLeft) throws NotFoundException {
|
||||
ResultPoint newTopLeft = topLeft;
|
||||
ResultPoint newBottomLeft = bottomLeft;
|
||||
ResultPoint newTopRight = topRight;
|
||||
ResultPoint newBottomRight = bottomRight;
|
||||
RXingResultPoint newTopLeft = topLeft;
|
||||
RXingResultPoint newBottomLeft = bottomLeft;
|
||||
RXingResultPoint newTopRight = topRight;
|
||||
RXingResultPoint newBottomRight = bottomRight;
|
||||
|
||||
if (missingStartRows > 0) {
|
||||
ResultPoint top = isLeft ? topLeft : topRight;
|
||||
RXingResultPoint top = isLeft ? topLeft : topRight;
|
||||
int newMinY = (int) top.getY() - missingStartRows;
|
||||
if (newMinY < 0) {
|
||||
newMinY = 0;
|
||||
}
|
||||
ResultPoint newTop = new ResultPoint(top.getX(), newMinY);
|
||||
RXingResultPoint newTop = new RXingResultPoint(top.getX(), newMinY);
|
||||
if (isLeft) {
|
||||
newTopLeft = newTop;
|
||||
} else {
|
||||
@@ -106,12 +106,12 @@ final class BoundingBox {
|
||||
}
|
||||
|
||||
if (missingEndRows > 0) {
|
||||
ResultPoint bottom = isLeft ? bottomLeft : bottomRight;
|
||||
RXingResultPoint bottom = isLeft ? bottomLeft : bottomRight;
|
||||
int newMaxY = (int) bottom.getY() + missingEndRows;
|
||||
if (newMaxY >= image.getHeight()) {
|
||||
newMaxY = image.getHeight() - 1;
|
||||
}
|
||||
ResultPoint newBottom = new ResultPoint(bottom.getX(), newMaxY);
|
||||
RXingResultPoint newBottom = new RXingResultPoint(bottom.getX(), newMaxY);
|
||||
if (isLeft) {
|
||||
newBottomLeft = newBottom;
|
||||
} else {
|
||||
@@ -138,19 +138,19 @@ final class BoundingBox {
|
||||
return maxY;
|
||||
}
|
||||
|
||||
ResultPoint getTopLeft() {
|
||||
RXingResultPoint getTopLeft() {
|
||||
return topLeft;
|
||||
}
|
||||
|
||||
ResultPoint getTopRight() {
|
||||
RXingResultPoint getTopRight() {
|
||||
return topRight;
|
||||
}
|
||||
|
||||
ResultPoint getBottomLeft() {
|
||||
RXingResultPoint getBottomLeft() {
|
||||
return bottomLeft;
|
||||
}
|
||||
|
||||
ResultPoint getBottomRight() {
|
||||
RXingResultPoint getBottomRight() {
|
||||
return bottomRight;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user