Sha256: 8d600e4df3ebf640aa798b2daace813fb58f3df761eda019f53265c9e7eaccf0

Contents?: true

Size: 1.73 KB

Versions: 13

Compression:

Stored size: 1.73 KB

Contents

// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
/*
 *  AlignmentPattern.cpp
 *  zxing
 *
 *  Created by Christian Brunschen on 13/05/2008.
 *  Copyright 2008 ZXing authors All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <zxing/qrcode/detector/AlignmentPattern.h>

using std::abs;
using zxing::Ref;
using zxing::qrcode::AlignmentPattern;

AlignmentPattern::AlignmentPattern(float posX, float posY, float estimatedModuleSize) :
    ResultPoint(posX,posY), estimatedModuleSize_(estimatedModuleSize) {
}

bool AlignmentPattern::aboutEquals(float moduleSize, float i, float j) const {
  if (abs(i - getY()) <= moduleSize && abs(j - getX()) <= moduleSize) {
    float moduleSizeDiff = abs(moduleSize - estimatedModuleSize_);
    return moduleSizeDiff <= 1.0f || moduleSizeDiff <= estimatedModuleSize_;
  }
  return false;
}

Ref<AlignmentPattern> AlignmentPattern::combineEstimate(float i, float j, float newModuleSize) const {
  float combinedX = (getX() + j) / 2.0f;
  float combinedY = (getY() + i) / 2.0f;
  float combinedModuleSize = (estimatedModuleSize_ + newModuleSize) / 2.0f;
  Ref<AlignmentPattern> result
      (new AlignmentPattern(combinedX, combinedY, combinedModuleSize));
  return result;
}

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
rhodes-7.6.0 lib/commonAPI/barcode/ext/platform/qt/src/qzxing/zxing/zxing/qrcode/detector/QRAlignmentPattern.cpp
rhodes-7.5.1 lib/commonAPI/barcode/ext/platform/qt/src/qzxing/zxing/zxing/qrcode/detector/QRAlignmentPattern.cpp
rhodes-7.4.1 lib/commonAPI/barcode/ext/platform/qt/src/qzxing/zxing/zxing/qrcode/detector/QRAlignmentPattern.cpp
zxing_cpp_mac_big_sur-0.1.1 ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp
rhodes-7.1.17 lib/commonAPI/barcode/ext/platform/qt/src/qzxing/zxing/zxing/qrcode/detector/QRAlignmentPattern.cpp
zxing_cpp_no_cmake-0.1.2 ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp
zxing_cpp_no_cmake-0.1.1 ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp
rhodes-6.2.0 lib/commonAPI/barcode/ext/platform/qt/src/qzxing/zxing/zxing/qrcode/detector/QRAlignmentPattern.cpp
rhodes-6.0.11 lib/commonAPI/barcode/ext/platform/qt/src/qzxing/zxing/zxing/qrcode/detector/QRAlignmentPattern.cpp
rhodes-5.5.18 lib/commonAPI/barcode/ext/platform/qt/src/qzxing/zxing/zxing/qrcode/detector/QRAlignmentPattern.cpp
rhodes-5.5.17 lib/commonAPI/barcode/ext/platform/qt/src/qzxing/zxing/zxing/qrcode/detector/QRAlignmentPattern.cpp
zxing_cpp-0.1.1 ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp
zxing_cpp-0.1.0 ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp