类com.google.zxing.ResultPointCallback源码实例Demo

下面列出了怎么用com.google.zxing.ResultPointCallback的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: QrCodeLib   文件: DecodeThread.java
DecodeThread(CaptureActivity activity,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

    this.activity = activity;
    handlerInitLatch = new CountDownLatch(1);

    hints = new Hashtable<DecodeHintType, Object>(3);

    if (decodeFormats == null || decodeFormats.isEmpty()) {
        decodeFormats = new Vector<BarcodeFormat>();
        decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
    }

    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

    if (characterSet != null) {
        hints.put(DecodeHintType.CHARACTER_SET, characterSet);
    }

    hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
源代码2 项目: vmqApk   文件: DecodeThread.java
DecodeThread(CaptureActivity activity,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

  this.activity = activity;
  handlerInitLatch = new CountDownLatch(1);

  hints = new Hashtable<DecodeHintType, Object>(3);

  if (decodeFormats == null || decodeFormats.isEmpty()) {
  	 decodeFormats = new Vector<BarcodeFormat>();
  	 decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
  }
  
  hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

  if (characterSet != null) {
    hints.put(DecodeHintType.CHARACTER_SET, characterSet);
  }

  hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
源代码3 项目: DoraemonKit   文件: DecodeThread.java
DecodeThread(CaptureActivity activity,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

    this.activity = activity;
    handlerInitLatch = new CountDownLatch(1);

    hints = new Hashtable<DecodeHintType, Object>(3);

    if (decodeFormats == null || decodeFormats.isEmpty()) {
        decodeFormats = new Vector<BarcodeFormat>();
        decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
    }

    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

    if (characterSet != null) {
        hints.put(DecodeHintType.CHARACTER_SET, characterSet);
    }

    hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
源代码4 项目: QrCodeDemo4   文件: DecodeThread.java
DecodeThread(CaptureActivity activity,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

  this.activity = activity;
  handlerInitLatch = new CountDownLatch(1);

  hints = new Hashtable<DecodeHintType, Object>(3);

  if (decodeFormats == null || decodeFormats.isEmpty()) {
  	 decodeFormats = new Vector<BarcodeFormat>();
  	 decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
  }
  
  hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

  if (characterSet != null) {
    hints.put(DecodeHintType.CHARACTER_SET, characterSet);
  }

  hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
源代码5 项目: ScreenCapture   文件: AlignmentPatternFinder.java
/**
 * <p>Creates a finder that will look in a portion of the whole image.</p>
 *
 * @param image image to search
 * @param startX left column from which to start searching
 * @param startY top row from which to start searching
 * @param width width of region to search
 * @param height height of region to search
 * @param moduleSize estimated module size so far
 */
AlignmentPatternFinder(BitMatrix image,
                       int startX,
                       int startY,
                       int width,
                       int height,
                       float moduleSize,
                       ResultPointCallback resultPointCallback) {
  this.image = image;
  this.possibleCenters = new ArrayList<>(5);
  this.startX = startX;
  this.startY = startY;
  this.width = width;
  this.height = height;
  this.moduleSize = moduleSize;
  this.crossCheckStateCount = new int[3];
  this.resultPointCallback = resultPointCallback;
}
 
源代码6 项目: ScreenCapture   文件: RSS14Reader.java
private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<DecodeHintType,?> hints) {
  try {
    int[] startEnd = findFinderPattern(row, right);
    FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, startEnd);

    ResultPointCallback resultPointCallback = hints == null ? null :
      (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);

    if (resultPointCallback != null) {
      float center = (startEnd[0] + startEnd[1]) / 2.0f;
      if (right) {
        // row is actually reversed
        center = row.getSize() - 1 - center;
      }
      resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, rowNumber));
    }

    DataCharacter outside = decodeDataCharacter(row, pattern, true);
    DataCharacter inside = decodeDataCharacter(row, pattern, false);
    return new Pair(1597 * outside.getValue() + inside.getValue(),
                    outside.getChecksumPortion() + 4 * inside.getChecksumPortion(),
                    pattern);
  } catch (NotFoundException ignored) {
    return null;
  }
}
 
源代码7 项目: ScreenCapture   文件: MultiDetector.java
public DetectorResult[] detectMulti(Map<DecodeHintType,?> hints) throws NotFoundException {
  BitMatrix image = getImage();
  ResultPointCallback resultPointCallback =
      hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
  MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
  FinderPatternInfo[] infos = finder.findMulti(hints);

  if (infos.length == 0) {
    throw NotFoundException.getNotFoundInstance();
  }

  List<DetectorResult> result = new ArrayList<>();
  for (FinderPatternInfo info : infos) {
    try {
      result.add(processFinderPatternInfo(info));
    } catch (ReaderException e) {
      // ignore
    }
  }
  if (result.isEmpty()) {
    return EMPTY_DETECTOR_RESULTS;
  } else {
    return result.toArray(new DetectorResult[result.size()]);
  }
}
 
源代码8 项目: Telegram   文件: MultiDetector.java
public DetectorResult[] detectMulti(Map<DecodeHintType,?> hints) throws NotFoundException {
  BitMatrix image = getImage();
  ResultPointCallback resultPointCallback =
      hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
  MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
  FinderPatternInfo[] infos = finder.findMulti(hints);

  if (infos.length == 0) {
    throw NotFoundException.getNotFoundInstance();
  }

  List<DetectorResult> result = new ArrayList<>();
  for (FinderPatternInfo info : infos) {
    try {
      result.add(processFinderPatternInfo(info));
    } catch (ReaderException e) {
      // ignore
    }
  }
  if (result.isEmpty()) {
    return EMPTY_DETECTOR_RESULTS;
  } else {
    return result.toArray(EMPTY_DETECTOR_RESULTS);
  }
}
 
/**
 * <p>Creates a finder that will look in a portion of the whole image.</p>
 *
 * @param image image to search
 * @param startX left column from which to start searching
 * @param startY top row from which to start searching
 * @param width width of region to search
 * @param height height of region to search
 * @param moduleSize estimated module size so far
 */
AlignmentPatternFinder(BitMatrix image,
                       int startX,
                       int startY,
                       int width,
                       int height,
                       float moduleSize,
                       ResultPointCallback resultPointCallback) {
  this.image = image;
  this.possibleCenters = new ArrayList<>(5);
  this.startX = startX;
  this.startY = startY;
  this.width = width;
  this.height = height;
  this.moduleSize = moduleSize;
  this.crossCheckStateCount = new int[3];
  this.resultPointCallback = resultPointCallback;
}
 
源代码10 项目: Mobike   文件: DecodeThread.java
DecodeThread(CaptureActivity activity,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

    this.activity = activity;
    handlerInitLatch = new CountDownLatch(1);

    hints = new Hashtable<DecodeHintType, Object>(3);

    if (decodeFormats == null || decodeFormats.isEmpty()) {
        decodeFormats = new Vector<BarcodeFormat>();
        decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
    }

    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

    if (characterSet != null) {
        hints.put(DecodeHintType.CHARACTER_SET, characterSet);
    }

    hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
源代码11 项目: iscanner_android   文件: DecodeThread.java
DecodeThread(MainActivity activity,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

  this.activity = activity;
  handlerInitLatch = new CountDownLatch(1);

  hints = new Hashtable<DecodeHintType, Object>(3);

  if (decodeFormats == null || decodeFormats.isEmpty()) {
  	 decodeFormats = new Vector<BarcodeFormat>();
  	 decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
  }
  
  hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

  if (characterSet != null) {
    hints.put(DecodeHintType.CHARACTER_SET, characterSet);
  }

  hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
源代码12 项目: ZXing-Orient   文件: MultiDetector.java
public DetectorResult[] detectMulti(Map<DecodeHintType,?> hints) throws NotFoundException {
  BitMatrix image = getImage();
  ResultPointCallback resultPointCallback =
      hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
  MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
  FinderPatternInfo[] infos = finder.findMulti(hints);

  if (infos.length == 0) {
    throw NotFoundException.getNotFoundInstance();
  }

  List<DetectorResult> result = new ArrayList<>();
  for (FinderPatternInfo info : infos) {
    try {
      result.add(processFinderPatternInfo(info));
    } catch (ReaderException e) {
      // ignore
    }
  }
  if (result.isEmpty()) {
    return EMPTY_DETECTOR_RESULTS;
  } else {
    return result.toArray(new DetectorResult[result.size()]);
  }
}
 
源代码13 项目: smart-farmer-android   文件: DecodeThread.java
DecodeThread(CaptureActivity activity,
        Vector<BarcodeFormat> decodeFormats,
        String characterSet,
        ResultPointCallback resultPointCallback) {

    this.activity = activity;
    handlerInitLatch = new CountDownLatch(1);

    hints = new Hashtable<DecodeHintType, Object>(3);

    if (decodeFormats == null || decodeFormats.isEmpty()) {
        decodeFormats = new Vector<BarcodeFormat>();
        decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
    }

    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

    if (characterSet != null) {
        hints.put(DecodeHintType.CHARACTER_SET, characterSet);
    }

    hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
源代码14 项目: vinci   文件: DecodeThread.java
DecodeThread(CaptureFragment fragment,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

    this.fragment = fragment;
    handlerInitLatch = new CountDownLatch(1);

    hints = new Hashtable<DecodeHintType, Object>(3);

    if (decodeFormats == null || decodeFormats.isEmpty()) {
        decodeFormats = new Vector<BarcodeFormat>();
        decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
        decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
    }

    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

    if (characterSet != null) {
        hints.put(DecodeHintType.CHARACTER_SET, characterSet);
    }

    hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
/**
 * <p>Creates a finder that will look in a portion of the whole image.</p>
 *
 * @param image image to search
 * @param startX left column from which to start searching
 * @param startY top row from which to start searching
 * @param width width of region to search
 * @param height height of region to search
 * @param moduleSize estimated module size so far
 */
AlignmentPatternFinder(BitMatrix image,
                       int startX,
                       int startY,
                       int width,
                       int height,
                       float moduleSize,
                       ResultPointCallback resultPointCallback) {
  this.image = image;
  this.possibleCenters = new ArrayList<>(5);
  this.startX = startX;
  this.startY = startY;
  this.width = width;
  this.height = height;
  this.moduleSize = moduleSize;
  this.crossCheckStateCount = new int[3];
  this.resultPointCallback = resultPointCallback;
}
 
private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<DecodeHintType,?> hints) {
  try {
    int[] startEnd = findFinderPattern(row, 0, right);
    FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, startEnd);

    ResultPointCallback resultPointCallback = hints == null ? null :
      (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);

    if (resultPointCallback != null) {
      float center = (startEnd[0] + startEnd[1]) / 2.0f;
      if (right) {
        // row is actually reversed
        center = row.getSize() - 1 - center;
      }
      resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, rowNumber));
    }

    DataCharacter outside = decodeDataCharacter(row, pattern, true);
    DataCharacter inside = decodeDataCharacter(row, pattern, false);
    return new Pair(1597 * outside.getValue() + inside.getValue(),
                    outside.getChecksumPortion() + 4 * inside.getChecksumPortion(),
                    pattern);
  } catch (NotFoundException ignored) {
    return null;
  }
}
 
源代码17 项目: Telegram-FOSS   文件: AlignmentPatternFinder.java
/**
 * <p>Creates a finder that will look in a portion of the whole image.</p>
 *
 * @param image image to search
 * @param startX left column from which to start searching
 * @param startY top row from which to start searching
 * @param width width of region to search
 * @param height height of region to search
 * @param moduleSize estimated module size so far
 */
AlignmentPatternFinder(BitMatrix image,
                       int startX,
                       int startY,
                       int width,
                       int height,
                       float moduleSize,
                       ResultPointCallback resultPointCallback) {
  this.image = image;
  this.possibleCenters = new ArrayList<>(5);
  this.startX = startX;
  this.startY = startY;
  this.width = width;
  this.height = height;
  this.moduleSize = moduleSize;
  this.crossCheckStateCount = new int[3];
  this.resultPointCallback = resultPointCallback;
}
 
源代码18 项目: Pix-Art-Messenger   文件: ScanActivity.java
private void decode(final byte[] data) {
    final PlanarYUVLuminanceSource source = cameraManager.buildLuminanceSource(data);
    final BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));

    try {
        hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, (ResultPointCallback) dot -> runOnUiThread(() -> scannerView.addDot(dot)));
        final Result scanResult = reader.decode(bitmap, hints);

        runOnUiThread(() -> handleResult(scanResult));
    } catch (final ReaderException x) {
        // retry
        cameraHandler.post(fetchAndDecodeRunnable);
    } finally {
        reader.reset();
    }
}
 
源代码19 项目: barcodescanner-lib-aar   文件: RSS14Reader.java
private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<DecodeHintType,?> hints) {
  try {
    int[] startEnd = findFinderPattern(row, 0, right);
    FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, startEnd);

    ResultPointCallback resultPointCallback = hints == null ? null :
      (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);

    if (resultPointCallback != null) {
      float center = (startEnd[0] + startEnd[1]) / 2.0f;
      if (right) {
        // row is actually reversed
        center = row.getSize() - 1 - center;
      }
      resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, rowNumber));
    }

    DataCharacter outside = decodeDataCharacter(row, pattern, true);
    DataCharacter inside = decodeDataCharacter(row, pattern, false);
    return new Pair(1597 * outside.getValue() + inside.getValue(),
                    outside.getChecksumPortion() + 4 * inside.getChecksumPortion(),
                    pattern);
  } catch (NotFoundException ignored) {
    return null;
  }
}
 
源代码20 项目: weex   文件: RSS14Reader.java
private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<DecodeHintType,?> hints) {
  try {
    int[] startEnd = findFinderPattern(row, 0, right);
    FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, startEnd);

    ResultPointCallback resultPointCallback = hints == null ? null :
      (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);

    if (resultPointCallback != null) {
      float center = (startEnd[0] + startEnd[1]) / 2.0f;
      if (right) {
        // row is actually reversed
        center = row.getSize() - 1 - center;
      }
      resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, rowNumber));
    }

    DataCharacter outside = decodeDataCharacter(row, pattern, true);
    DataCharacter inside = decodeDataCharacter(row, pattern, false);
    return new Pair(1597 * outside.getValue() + inside.getValue(),
                    outside.getChecksumPortion() + 4 * inside.getChecksumPortion(),
                    pattern);
  } catch (NotFoundException ignored) {
    return null;
  }
}
 
源代码21 项目: weex   文件: MultiDetector.java
public DetectorResult[] detectMulti(Map<DecodeHintType,?> hints) throws NotFoundException {
  BitMatrix image = getImage();
  ResultPointCallback resultPointCallback =
      hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
  MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
  FinderPatternInfo[] infos = finder.findMulti(hints);

  if (infos.length == 0) {
    throw NotFoundException.getNotFoundInstance();
  }

  List<DetectorResult> result = new ArrayList<>();
  for (FinderPatternInfo info : infos) {
    try {
      result.add(processFinderPatternInfo(info));
    } catch (ReaderException e) {
      // ignore
    }
  }
  if (result.isEmpty()) {
    return EMPTY_DETECTOR_RESULTS;
  } else {
    return result.toArray(new DetectorResult[result.size()]);
  }
}
 
源代码22 项目: Telegram-FOSS   文件: MultiDetector.java
public DetectorResult[] detectMulti(Map<DecodeHintType,?> hints) throws NotFoundException {
  BitMatrix image = getImage();
  ResultPointCallback resultPointCallback =
      hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
  MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
  FinderPatternInfo[] infos = finder.findMulti(hints);

  if (infos.length == 0) {
    throw NotFoundException.getNotFoundInstance();
  }

  List<DetectorResult> result = new ArrayList<>();
  for (FinderPatternInfo info : infos) {
    try {
      result.add(processFinderPatternInfo(info));
    } catch (ReaderException e) {
      // ignore
    }
  }
  if (result.isEmpty()) {
    return EMPTY_DETECTOR_RESULTS;
  } else {
    return result.toArray(EMPTY_DETECTOR_RESULTS);
  }
}
 
源代码23 项目: KSYMediaPlayer_Android   文件: DecodeThread.java
DecodeThread(CaptureActivity activity,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

  this.activity = activity;
  handlerInitLatch = new CountDownLatch(1);

  hints = new Hashtable<DecodeHintType, Object>(3);

  if (decodeFormats == null || decodeFormats.isEmpty()) {
  	 decodeFormats = new Vector<BarcodeFormat>();
  	 decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
  }
  
  hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

  if (characterSet != null) {
    hints.put(DecodeHintType.CHARACTER_SET, characterSet);
  }

  hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
源代码24 项目: barcodescanner-lib-aar   文件: MultiDetector.java
public DetectorResult[] detectMulti(Map<DecodeHintType,?> hints) throws NotFoundException {
  BitMatrix image = getImage();
  ResultPointCallback resultPointCallback =
      hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
  MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
  FinderPatternInfo[] infos = finder.findMulti(hints);

  if (infos.length == 0) {
    throw NotFoundException.getNotFoundInstance();
  }

  List<DetectorResult> result = new ArrayList<>();
  for (FinderPatternInfo info : infos) {
    try {
      result.add(processFinderPatternInfo(info));
    } catch (ReaderException e) {
      // ignore
    }
  }
  if (result.isEmpty()) {
    return EMPTY_DETECTOR_RESULTS;
  } else {
    return result.toArray(new DetectorResult[result.size()]);
  }
}
 
源代码25 项目: qrcode_android   文件: CameraDecodeThread.java
public CameraDecodeThread(IZXingActivity ivew, int decodeMode) {

        this.ivew = ivew;
        this.activity = ivew.getActivity();
        handlerInitLatch = new CountDownLatch(1);

        hints = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);

        Collection<BarcodeFormat> decodeFormats = new ArrayList<BarcodeFormat>();
        //移除了所有与BarcodeFormat.CODE_128,二维码,不相关的格式
//        decodeFormats.addAll(EnumSet.of(BarcodeFormat.AZTEC));
//        decodeFormats.addAll(EnumSet.of(BarcodeFormat.PDF_417));

        switch (decodeMode) {
            case BARCODE_MODE:
                decodeFormats.addAll(DecodeFormatManager.getBarCodeFormats());
                break;

            case QRCODE_MODE:
                decodeFormats.addAll(DecodeFormatManager.getQrCodeFormats());
                break;

            case ALL_MODE:
                decodeFormats.addAll(DecodeFormatManager.getBarCodeFormats());
                decodeFormats.addAll(DecodeFormatManager.getQrCodeFormats());
                break;

            default:
                break;
        }

        hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
        hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, new ResultPointCallback() {
            @Override
            public void foundPossibleResultPoint(ResultPoint point) {
                CameraZoomStrategy.getInstance().findPossiblePoint(point);
            }
        });
    }
 
源代码26 项目: Telegram-FOSS   文件: Detector.java
/**
 * <p>Detects a QR Code in an image.</p>
 *
 * @param hints optional hints to detector
 * @return {@link DetectorResult} encapsulating results of detecting a QR Code
 * @throws NotFoundException if QR Code cannot be found
 * @throws FormatException if a QR Code cannot be decoded
 */
public final DetectorResult detect(Map<DecodeHintType,?> hints) throws NotFoundException, FormatException {

  resultPointCallback = hints == null ? null :
      (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);

  FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
  FinderPatternInfo info = finder.find(hints);

  return processFinderPatternInfo(info);
}
 
源代码27 项目: ScreenCapture   文件: Detector.java
/**
 * <p>Detects a QR Code in an image.</p>
 *
 * @param hints optional hints to detector
 * @return {@link DetectorResult} encapsulating results of detecting a QR Code
 * @throws NotFoundException if QR Code cannot be found
 * @throws FormatException if a QR Code cannot be decoded
 */
public final DetectorResult detect(Map<DecodeHintType,?> hints) throws NotFoundException, FormatException {

  resultPointCallback = hints == null ? null :
      (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);

  FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
  FinderPatternInfo info = finder.find(hints);

  return processFinderPatternInfo(info);
}
 
源代码28 项目: CodeScaner   文件: DecodeThread.java
DecodeThread(CaptureActivity activity,
             Collection<BarcodeFormat> decodeFormats,
             Map<DecodeHintType,?> baseHints,
             String characterSet,
             ResultPointCallback resultPointCallback) {

  this.activity = activity;
  handlerInitLatch = new CountDownLatch(1);

  hints = new EnumMap<>(DecodeHintType.class);
  if (baseHints != null) {
    hints.putAll(baseHints);
  }

  // The prefs can't change while the thread is running, so pick them up once here.
  if (decodeFormats == null || decodeFormats.isEmpty()) {
      decodeFormats = EnumSet.noneOf(BarcodeFormat.class);
      decodeFormats.addAll(DecodeFormatManager.PRODUCT_FORMATS);
      decodeFormats.addAll(DecodeFormatManager.INDUSTRIAL_FORMATS);
      decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
      decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
      decodeFormats.addAll(DecodeFormatManager.AZTEC_FORMATS);
      decodeFormats.addAll(DecodeFormatManager.PDF417_FORMATS);
  }
  hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

  if (characterSet != null) {
    hints.put(DecodeHintType.CHARACTER_SET, characterSet);
  }
  hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
  Log.i("DecodeThread", "Hints: " + hints);
}
 
源代码29 项目: MiBandDecompiled   文件: FinderPatternFinder.java
public FinderPatternFinder(BitMatrix bitmatrix, ResultPointCallback resultpointcallback)
{
    c = bitmatrix;
    d = new ArrayList();
    f = new int[5];
    g = resultpointcallback;
}
 
源代码30 项目: MiBandDecompiled   文件: AztecReader.java
public Result decode(BinaryBitmap binarybitmap, Map map)
{
    AztecDetectorResult aztecdetectorresult = (new Detector(binarybitmap.getBlackMatrix())).detect();
    com.google.zxing.ResultPoint aresultpoint[] = aztecdetectorresult.getPoints();
    if (map != null)
    {
        ResultPointCallback resultpointcallback = (ResultPointCallback)map.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
        if (resultpointcallback != null)
        {
            int i = aresultpoint.length;
            for (int j = 0; j < i; j++)
            {
                resultpointcallback.foundPossibleResultPoint(aresultpoint[j]);
            }

        }
    }
    DecoderResult decoderresult = (new Decoder()).decode(aztecdetectorresult);
    Result result = new Result(decoderresult.getText(), decoderresult.getRawBytes(), aresultpoint, BarcodeFormat.AZTEC);
    java.util.List list = decoderresult.getByteSegments();
    if (list != null)
    {
        result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, list);
    }
    String s = decoderresult.getECLevel();
    if (s != null)
    {
        result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, s);
    }
    return result;
}
 
 类所在包
 同包方法