move all Result to RXingResult

This commit is contained in:
Henry Schimke
2022-08-20 12:12:30 -05:00
parent 9f72478dc8
commit 90ace738b7
149 changed files with 1658 additions and 1658 deletions

View File

@@ -25,7 +25,7 @@ import java.util.List;
*
* @author Sean Owen
*/
public final class DecoderResult {
public final class DecoderRXingResult {
private final byte[] rawBytes;
private int numBits;
@@ -39,14 +39,14 @@ public final class DecoderResult {
private final int structuredAppendSequenceNumber;
private final int symbologyModifier;
public DecoderResult(byte[] rawBytes,
public DecoderRXingResult(byte[] rawBytes,
String text,
List<byte[]> byteSegments,
String ecLevel) {
this(rawBytes, text, byteSegments, ecLevel, -1, -1, 0);
}
public DecoderResult(byte[] rawBytes,
public DecoderRXingResult(byte[] rawBytes,
String text,
List<byte[]> byteSegments,
String ecLevel,
@@ -54,7 +54,7 @@ public final class DecoderResult {
this(rawBytes, text, byteSegments, ecLevel, -1, -1, symbologyModifier);
}
public DecoderResult(byte[] rawBytes,
public DecoderRXingResult(byte[] rawBytes,
String text,
List<byte[]> byteSegments,
String ecLevel,
@@ -63,7 +63,7 @@ public final class DecoderResult {
this(rawBytes, text, byteSegments, ecLevel, saSequence, saParity, 0);
}
public DecoderResult(byte[] rawBytes,
public DecoderRXingResult(byte[] rawBytes,
String text,
List<byte[]> byteSegments,
String ecLevel,

View File

@@ -16,7 +16,7 @@
package com.google.zxing.common;
import com.google.zxing.ResultPoint;
import com.google.zxing.RXingResultPoint;
/**
* <p>Encapsulates the result of detecting a barcode in an image. This includes the raw
@@ -25,12 +25,12 @@ import com.google.zxing.ResultPoint;
*
* @author Sean Owen
*/
public class DetectorResult {
public class DetectorRXingResult {
private final BitMatrix bits;
private final ResultPoint[] points;
private final RXingResultPoint[] points;
public DetectorResult(BitMatrix bits, ResultPoint[] points) {
public DetectorRXingResult(BitMatrix bits, RXingResultPoint[] points) {
this.bits = bits;
this.points = points;
}
@@ -39,7 +39,7 @@ public class DetectorResult {
return bits;
}
public final ResultPoint[] getPoints() {
public final RXingResultPoint[] getPoints() {
return points;
}

View File

@@ -15,7 +15,7 @@
*/
//package com.google.zxing.common.detector;
use crate::{NotFoundException,ResultPoint};
use crate::{NotFoundException,RXingResultPoint};
use crate::common::BitMatrix;
@@ -42,13 +42,13 @@ public final class MonochromeRectangleDetector {
* <p>Detects a rectangular region of black and white -- mostly black -- with a region of mostly
* white, in an image.</p>
*
* @return {@link ResultPoint}[] describing the corners of the rectangular region. The first and
* @return {@link RXingResultPoint}[] describing the corners of the rectangular region. The first and
* last points are opposed on the diagonal, as are the second and third. The first point will be
* the topmost point and the last, the bottommost. The second point will be leftmost and the
* third, the rightmost
* @throws NotFoundException if no Data Matrix Code can be found
*/
public ResultPoint[] detect() throws NotFoundException {
public RXingResultPoint[] detect() throws NotFoundException {
int height = image.getHeight();
int width = image.getWidth();
int halfHeight = height / 2;
@@ -60,16 +60,16 @@ public final class MonochromeRectangleDetector {
int bottom = height;
int left = 0;
int right = width;
ResultPoint pointA = findCornerFromCenter(halfWidth, 0, left, right,
RXingResultPoint pointA = findCornerFromCenter(halfWidth, 0, left, right,
halfHeight, -deltaY, top, bottom, halfWidth / 2);
top = (int) pointA.getY() - 1;
ResultPoint pointB = findCornerFromCenter(halfWidth, -deltaX, left, right,
RXingResultPoint pointB = findCornerFromCenter(halfWidth, -deltaX, left, right,
halfHeight, 0, top, bottom, halfHeight / 2);
left = (int) pointB.getX() - 1;
ResultPoint pointC = findCornerFromCenter(halfWidth, deltaX, left, right,
RXingResultPoint pointC = findCornerFromCenter(halfWidth, deltaX, left, right,
halfHeight, 0, top, bottom, halfHeight / 2);
right = (int) pointC.getX() + 1;
ResultPoint pointD = findCornerFromCenter(halfWidth, 0, left, right,
RXingResultPoint pointD = findCornerFromCenter(halfWidth, 0, left, right,
halfHeight, deltaY, top, bottom, halfWidth / 2);
bottom = (int) pointD.getY() + 1;
@@ -77,7 +77,7 @@ public final class MonochromeRectangleDetector {
pointA = findCornerFromCenter(halfWidth, 0, left, right,
halfHeight, -deltaY, top, bottom, halfWidth / 4);
return new ResultPoint[] { pointA, pointB, pointC, pointD };
return new RXingResultPoint[] { pointA, pointB, pointC, pointD };
}
/**
@@ -95,10 +95,10 @@ public final class MonochromeRectangleDetector {
* @param bottom maximum value of y
* @param maxWhiteRun maximum run of white pixels that can still be considered to be within
* the barcode
* @return a {@link ResultPoint} encapsulating the corner that was found
* @return a {@link RXingResultPoint} encapsulating the corner that was found
* @throws NotFoundException if such a point cannot be found
*/
private ResultPoint findCornerFromCenter(int centerX,
private RXingResultPoint findCornerFromCenter(int centerX,
int deltaX,
int left,
int right,
@@ -129,21 +129,21 @@ public final class MonochromeRectangleDetector {
if (lastRange[0] < centerX) {
if (lastRange[1] > centerX) {
// straddle, choose one or the other based on direction
return new ResultPoint(lastRange[deltaY > 0 ? 0 : 1], lastY);
return new RXingResultPoint(lastRange[deltaY > 0 ? 0 : 1], lastY);
}
return new ResultPoint(lastRange[0], lastY);
return new RXingResultPoint(lastRange[0], lastY);
} else {
return new ResultPoint(lastRange[1], lastY);
return new RXingResultPoint(lastRange[1], lastY);
}
} else {
int lastX = x - deltaX;
if (lastRange[0] < centerY) {
if (lastRange[1] > centerY) {
return new ResultPoint(lastX, lastRange[deltaX < 0 ? 0 : 1]);
return new RXingResultPoint(lastX, lastRange[deltaX < 0 ? 0 : 1]);
}
return new ResultPoint(lastX, lastRange[0]);
return new RXingResultPoint(lastX, lastRange[0]);
} else {
return new ResultPoint(lastX, lastRange[1]);
return new RXingResultPoint(lastX, lastRange[1]);
}
}
}

View File

@@ -17,7 +17,7 @@
package com.google.zxing.common.detector;
import com.google.zxing.NotFoundException;
import com.google.zxing.ResultPoint;
import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
/**
@@ -75,14 +75,14 @@ public final class WhiteRectangleDetector {
* region until it finds a white rectangular region.
* </p>
*
* @return {@link ResultPoint}[] describing the corners of the rectangular
* @return {@link RXingResultPoint}[] describing the corners of the rectangular
* region. The first and last points are opposed on the diagonal, as
* are the second and third. The first point will be the topmost
* point and the last, the bottommost. The second point will be
* leftmost and the third, the rightmost
* @throws NotFoundException if no Data Matrix Code can be found
*/
public ResultPoint[] detect() throws NotFoundException {
public RXingResultPoint[] detect() throws NotFoundException {
int left = leftInit;
int right = rightInit;
@@ -186,7 +186,7 @@ public final class WhiteRectangleDetector {
int maxSize = right - left;
ResultPoint z = null;
RXingResultPoint z = null;
for (int i = 1; z == null && i < maxSize; i++) {
z = getBlackPointOnSegment(left, down - i, left + i, down);
}
@@ -195,7 +195,7 @@ public final class WhiteRectangleDetector {
throw NotFoundException.getNotFoundInstance();
}
ResultPoint t = null;
RXingResultPoint t = null;
//go down right
for (int i = 1; t == null && i < maxSize; i++) {
t = getBlackPointOnSegment(left, up + i, left + i, up);
@@ -205,7 +205,7 @@ public final class WhiteRectangleDetector {
throw NotFoundException.getNotFoundInstance();
}
ResultPoint x = null;
RXingResultPoint x = null;
//go down left
for (int i = 1; x == null && i < maxSize; i++) {
x = getBlackPointOnSegment(right, up + i, right - i, up);
@@ -215,7 +215,7 @@ public final class WhiteRectangleDetector {
throw NotFoundException.getNotFoundInstance();
}
ResultPoint y = null;
RXingResultPoint y = null;
//go up left
for (int i = 1; y == null && i < maxSize; i++) {
y = getBlackPointOnSegment(right, down - i, right - i, down);
@@ -232,7 +232,7 @@ public final class WhiteRectangleDetector {
}
}
private ResultPoint getBlackPointOnSegment(float aX, float aY, float bX, float bY) {
private RXingResultPoint getBlackPointOnSegment(float aX, float aY, float bX, float bY) {
int dist = MathUtils.round(MathUtils.distance(aX, aY, bX, bY));
float xStep = (bX - aX) / dist;
float yStep = (bY - aY) / dist;
@@ -241,7 +241,7 @@ public final class WhiteRectangleDetector {
int x = MathUtils.round(aX + i * xStep);
int y = MathUtils.round(aY + i * yStep);
if (image.get(x, y)) {
return new ResultPoint(x, y);
return new RXingResultPoint(x, y);
}
}
return null;
@@ -254,14 +254,14 @@ public final class WhiteRectangleDetector {
* @param z left most point
* @param x right most point
* @param t top most point
* @return {@link ResultPoint}[] describing the corners of the rectangular
* @return {@link RXingResultPoint}[] describing the corners of the rectangular
* region. The first and last points are opposed on the diagonal, as
* are the second and third. The first point will be the topmost
* point and the last, the bottommost. The second point will be
* leftmost and the third, the rightmost
*/
private ResultPoint[] centerEdges(ResultPoint y, ResultPoint z,
ResultPoint x, ResultPoint t) {
private RXingResultPoint[] centerEdges(RXingResultPoint y, RXingResultPoint z,
RXingResultPoint x, RXingResultPoint t) {
//
// t t
@@ -280,17 +280,17 @@ public final class WhiteRectangleDetector {
float tj = t.getY();
if (yi < width / 2.0f) {
return new ResultPoint[]{
new ResultPoint(ti - CORR, tj + CORR),
new ResultPoint(zi + CORR, zj + CORR),
new ResultPoint(xi - CORR, xj - CORR),
new ResultPoint(yi + CORR, yj - CORR)};
return new RXingResultPoint[]{
new RXingResultPoint(ti - CORR, tj + CORR),
new RXingResultPoint(zi + CORR, zj + CORR),
new RXingResultPoint(xi - CORR, xj - CORR),
new RXingResultPoint(yi + CORR, yj - CORR)};
} else {
return new ResultPoint[]{
new ResultPoint(ti + CORR, tj + CORR),
new ResultPoint(zi + CORR, zj - CORR),
new ResultPoint(xi - CORR, xj + CORR),
new ResultPoint(yi - CORR, yj - CORR)};
return new RXingResultPoint[]{
new RXingResultPoint(ti + CORR, tj + CORR),
new RXingResultPoint(zi + CORR, zj - CORR),
new RXingResultPoint(xi - CORR, xj + CORR),
new RXingResultPoint(yi - CORR, yj - CORR)};
}
}