rxing/aztec/aztec_detector_result.rs
1/*
2 * Copyright 2010 ZXing authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// package com.google.zxing.aztec;
18
19// import com.google.zxing.Point;
20// import com.google.zxing.common.BitMatrix;
21// import com.google.zxing.common.DetectorRXingResult;
22
23use crate::{
24 common::{BitMatrix, DetectorRXingResult},
25 Point,
26};
27
28/**
29 * <p>Extends {@link DetectorRXingResult} with more information specific to the Aztec format,
30 * like the number of layers and whether it's compact.</p>
31 *
32 * @author Sean Owen
33 */
34pub struct AztecDetectorRXingResult {
35 bits: BitMatrix,
36 points: [Point; 4],
37 compact: bool,
38 nbDatablocks: u32,
39 nbLayers: u32,
40}
41
42impl DetectorRXingResult for AztecDetectorRXingResult {
43 fn getBits(&self) -> &BitMatrix {
44 &self.bits
45 }
46
47 fn getPoints(&self) -> &[Point] {
48 &self.points
49 }
50}
51
52impl AztecDetectorRXingResult {
53 pub fn new(
54 bits: BitMatrix,
55 points: [Point; 4],
56 compact: bool,
57 nbDatablocks: u32,
58 nbLayers: u32,
59 ) -> Self {
60 Self {
61 bits,
62 points,
63 compact,
64 nbDatablocks,
65 nbLayers,
66 }
67 }
68
69 pub const fn getNbLayers(&self) -> u32 {
70 self.nbLayers
71 }
72
73 pub fn getNbDatablocks(&self) -> u32 {
74 self.nbDatablocks
75 }
76
77 pub const fn isCompact(&self) -> bool {
78 self.compact
79 }
80}