mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
swap point_f and point functions
This commit is contained in:
@@ -23,7 +23,7 @@ use crate::{
|
||||
},
|
||||
BitMatrix, PerspectiveTransform, Quadrilateral,
|
||||
},
|
||||
point, Point,
|
||||
point_f, Point,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq)]
|
||||
@@ -90,7 +90,7 @@ pub fn FindFinderPatterns(image: &BitMatrix, tryHarder: bool) -> FinderPatterns
|
||||
false
|
||||
}
|
||||
} {
|
||||
let p = point(
|
||||
let p = point_f(
|
||||
next.pixelsInFront() as f32
|
||||
+ next[0] as f32
|
||||
+ next[1] as f32
|
||||
@@ -412,15 +412,15 @@ pub fn LocateAlignmentPattern(
|
||||
// log(estimate, 2);
|
||||
|
||||
for d in [
|
||||
point(0.0, 0.0),
|
||||
point(0.0, -1.0),
|
||||
point(0.0, 1.0),
|
||||
point(-1.0, 0.0),
|
||||
point(1.0, 0.0),
|
||||
point(-1.0, -1.0),
|
||||
point(1.0, -1.0),
|
||||
point(1.0, 1.0),
|
||||
point(-1.0, 1.0),
|
||||
point_f(0.0, 0.0),
|
||||
point_f(0.0, -1.0),
|
||||
point_f(0.0, 1.0),
|
||||
point_f(-1.0, 0.0),
|
||||
point_f(1.0, 0.0),
|
||||
point_f(-1.0, -1.0),
|
||||
point_f(1.0, -1.0),
|
||||
point_f(1.0, 1.0),
|
||||
point_f(-1.0, 1.0),
|
||||
] {
|
||||
// for (auto d : {PointF{0, 0}, {0, -1}, {0, 1}, {-1, 0}, {1, 0}, {-1, -1}, {1, -1}, {1, 1}, {-1, 1},
|
||||
// #if 1
|
||||
@@ -515,7 +515,7 @@ pub fn SampleQR(image: &BitMatrix, fp: &FinderPatternSet) -> Result<QRCodeDetect
|
||||
let moduleSize = (best.ms + 1.0) as i32;
|
||||
|
||||
let mut br = ConcentricPattern {
|
||||
p: point(-1.0, -1.0),
|
||||
p: point_f(-1.0, -1.0),
|
||||
size: 0,
|
||||
};
|
||||
let mut brOffset = point_i(3, 3);
|
||||
@@ -822,8 +822,8 @@ pub fn DetectPureQR(image: &BitMatrix) -> Result<QRCodeDetectorResult> {
|
||||
// allow corners be moved one pixel inside to accommodate for possible aliasing artifacts
|
||||
for [p, d] in [
|
||||
[tl, point_i(1, 1)],
|
||||
[tr, point(-1.0, 1.0)],
|
||||
[bl, point(1.0, -1.0)],
|
||||
[tr, point_f(-1.0, 1.0)],
|
||||
[bl, point_f(1.0, -1.0)],
|
||||
] {
|
||||
diagonal = EdgeTracer::new(image, p, d)
|
||||
.readPatternFromBlack(1, Some((width / 3 + 1) as i32))
|
||||
@@ -844,7 +844,7 @@ pub fn DetectPureQR(image: &BitMatrix) -> Result<QRCodeDetectorResult> {
|
||||
size: fpWidth,
|
||||
},
|
||||
ConcentricPattern {
|
||||
p: tr + fpWidth as f32 / 2.0 * point(-1.0, 1.0),
|
||||
p: tr + fpWidth as f32 / 2.0 * point_f(-1.0, 1.0),
|
||||
size: fpWidth,
|
||||
},
|
||||
)
|
||||
@@ -853,7 +853,7 @@ pub fn DetectPureQR(image: &BitMatrix) -> Result<QRCodeDetectorResult> {
|
||||
let moduleSize: f32 = ((width) as f32) / dimension as f32;
|
||||
if dimension < MIN_MODULES as i32
|
||||
|| dimension > MAX_MODULES as i32
|
||||
|| !image.is_in(point(
|
||||
|| !image.is_in(point_f(
|
||||
left as f32 + moduleSize / 2.0 + (dimension - 1) as f32 * moduleSize,
|
||||
top as f32 + moduleSize / 2.0 + (dimension - 1) as f32 * moduleSize,
|
||||
))
|
||||
@@ -921,7 +921,7 @@ pub fn DetectPureMQR(image: &BitMatrix) -> Result<QRCodeDetectorResult> {
|
||||
|
||||
if dimension < MIN_MODULES
|
||||
|| dimension > MAX_MODULES
|
||||
|| !image.is_in(point(
|
||||
|| !image.is_in(point_f(
|
||||
left as f32 + moduleSize / 2.0 + (dimension - 1) as f32 * moduleSize,
|
||||
top as f32 + moduleSize / 2.0 + (dimension - 1) as f32 * moduleSize,
|
||||
))
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//Point
|
||||
|
||||
use crate::{point, Point};
|
||||
use crate::{point_f, Point};
|
||||
|
||||
/**
|
||||
* <p>Encapsulates an alignment pattern, which are the smaller square patterns found in
|
||||
@@ -46,7 +46,7 @@ impl AlignmentPattern {
|
||||
pub fn new(posX: f32, posY: f32, estimatedModuleSize: f32) -> Self {
|
||||
Self {
|
||||
estimatedModuleSize,
|
||||
point: point(posX, posY),
|
||||
point: point_f(posX, posY),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use crate::{point, Point};
|
||||
use crate::{point_f, Point};
|
||||
|
||||
/**
|
||||
* <p>Encapsulates a finder pattern, which are the three square patterns found in
|
||||
@@ -51,7 +51,7 @@ impl FinderPattern {
|
||||
Self {
|
||||
estimatedModuleSize,
|
||||
count,
|
||||
point: point(posX, posY),
|
||||
point: point_f(posX, posY),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ use crate::{
|
||||
BitMatrix, DefaultGridSampler, GridSampler, PerspectiveTransform, Quadrilateral, Result,
|
||||
SamplerControl,
|
||||
},
|
||||
point,
|
||||
point_f,
|
||||
qrcode::decoder::Version,
|
||||
DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, Point, PointCallback,
|
||||
};
|
||||
@@ -197,15 +197,15 @@ impl<'a> Detector<'_> {
|
||||
}
|
||||
|
||||
let dst = Quadrilateral::new(
|
||||
point(3.5, 3.5),
|
||||
point(dimMinusThree, 3.5),
|
||||
point(sourceBottomRightX, sourceBottomRightY),
|
||||
point(3.5, dimMinusThree),
|
||||
point_f(3.5, 3.5),
|
||||
point_f(dimMinusThree, 3.5),
|
||||
point_f(sourceBottomRightX, sourceBottomRightY),
|
||||
point_f(3.5, dimMinusThree),
|
||||
);
|
||||
let src = Quadrilateral::new(
|
||||
topLeft,
|
||||
topRight,
|
||||
point(bottomRightX, bottomRightY),
|
||||
point_f(bottomRightX, bottomRightY),
|
||||
bottomLeft,
|
||||
);
|
||||
|
||||
@@ -386,8 +386,8 @@ impl<'a> Detector<'_> {
|
||||
if (state == 1) == self.image.get(realX as u32, realY as u32) {
|
||||
if state == 2 {
|
||||
return Point::distance(
|
||||
point(x as f32, y as f32),
|
||||
point(fromX as f32, fromY as f32),
|
||||
point_f(x as f32, y as f32),
|
||||
point_f(fromX as f32, fromY as f32),
|
||||
);
|
||||
}
|
||||
state += 1;
|
||||
@@ -409,8 +409,8 @@ impl<'a> Detector<'_> {
|
||||
// small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this.
|
||||
if state == 2 {
|
||||
return Point::distance(
|
||||
point((toX as i32 + xstep) as f32, toY as f32),
|
||||
point(fromX as f32, fromY as f32),
|
||||
point_f((toX as i32 + xstep) as f32, toY as f32),
|
||||
point_f(fromX as f32, fromY as f32),
|
||||
);
|
||||
}
|
||||
// else we didn't find even black-white-black; no estimate is really possible
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::{BitMatrix, DecoderRXingResult, DetectorRXingResult, Result},
|
||||
point, BarcodeFormat, Binarizer, DecodeHintType, DecodeHintValue, Exceptions, Point,
|
||||
point_f, BarcodeFormat, Binarizer, DecodeHintType, DecodeHintValue, Exceptions, Point,
|
||||
RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Reader,
|
||||
};
|
||||
|
||||
@@ -237,7 +237,7 @@ impl QRCodeReader {
|
||||
let mut inBlack = true;
|
||||
let mut transitions = 0;
|
||||
while x < width && y < height {
|
||||
if inBlack != image.get_point(point(x, y)) {
|
||||
if inBlack != image.get_point(point_f(x, y)) {
|
||||
transitions += 1;
|
||||
if transitions == 5 {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user