public BitMatrix encode(String contents, BarcodeFormat format, int width, int height) throws WriterException { try { return new MultiFormatWriter().encode(contents, format, width, height); } catch (WriterException e) { throw e; } catch (Exception e) { // ZXing sometimes throws an IllegalArgumentException throw new WriterException(e); } }
DecodeHandler(CaptureActivity activity, Hashtable<DecodeHintType, Object> hints) { multiFormatReader = new MultiFormatReader(); multiFormatReader.setHints(hints); this.activity = activity; }
/** * @return points related to the barcode in the image. These are typically points * identifying finder patterns or the corners of the barcode. The exact meaning is * specific to the type of barcode that was decoded. * @see Result#getResultPoints() */ public ResultPoint[] getResultPoints() { return mResult.getResultPoints(); }
/** * Given an image source, convert to a binary bitmap. * * Override this to use a custom binarizer. * * @param source the image source * @return a BinaryBitmap */ protected BinaryBitmap toBitmap(LuminanceSource source) { return new BinaryBitmap(new HybridBinarizer(source.invert())); } }
/** * Given an image source, convert to a binary bitmap. * * Override this to use a custom binarizer. * * @param source the image source * @return a BinaryBitmap */ protected BinaryBitmap toBitmap(LuminanceSource source) { return new BinaryBitmap(new HybridBinarizer(source)); }
/** * @return raw text encoded by the barcode * @see Result#getText() */ public String getText() { return mResult.getText(); }
/** * @return {@link BarcodeFormat} representing the format of the barcode that was decoded * @see Result#getBarcodeFormat() */ public BarcodeFormat getBarcodeFormat() { return mResult.getBarcodeFormat(); }
protected BitMatrix createMatrix(String text) throws WriterException { return qrWriter.encode(text, com.google.zxing.BarcodeFormat.QR_CODE, width, height, hints); }
/** * @return {@link Map} mapping {@link ResultMetadataType} keys to values. May be * {@code null}. This contains optional metadata about what was detected about the barcode, * like orientation. * @see Result#getResultMetadata() */ public Map<ResultMetadataType, Object> getResultMetadata() { return mResult.getResultMetadata(); }
public long getTimestamp() { return mResult.getTimestamp(); }
/** * @return raw bytes encoded by the barcode, if applicable, otherwise {@code null} * @see Result#getRawBytes() */ public byte[] getRawBytes() { return mResult.getRawBytes(); }
private void vibrate(long duration) { Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); long[] pattern = { 0, duration }; vibrator.vibrate(pattern, -1); }
/** * Given an image source, convert to a binary bitmap. * * Override this to use a custom binarizer. * * @param source the image source * @return a BinaryBitmap */ protected BinaryBitmap toBitmap(LuminanceSource source) { if (isInverted) { isInverted = false; return new BinaryBitmap(new HybridBinarizer(source.invert())); } else { isInverted = true; return new BinaryBitmap(new HybridBinarizer(source)); } }
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints) throws WriterException { try { return new MultiFormatWriter().encode(contents, format, width, height, hints); } catch (WriterException e) { throw e; } catch (Exception e) { throw new WriterException(e); } }
DecodeHandler(CaptureFragment fragment, Hashtable<DecodeHintType, Object> hints) { multiFormatReader = new MultiFormatReader(); multiFormatReader.setHints(hints); this.fragment = fragment; }
@Override public String toString() { return mResult.getText(); } }
DecodeHandler(CaptureActivity activity, Hashtable<DecodeHintType, Object> hints) { multiFormatReader = new MultiFormatReader(); multiFormatReader.setHints(hints); this.activity = activity; }
@Override public void accept(Result result) throws Exception { Toast.makeText(LongImageActivity.this, "Found " + result.getText(), Toast.LENGTH_SHORT).show(); } }, new Consumer<Throwable>() {
DecodeHandler(QrCodeScanActivity activity, Map<DecodeHintType, Object> hints) { multiFormatReader = new MultiFormatReader(); multiFormatReader.setHints(hints); this.activity = activity; }