com.google.zxing.qrcode.decoder.ErrorCorrectionLevel# L 源码实例Demo

下面列出了com.google.zxing.qrcode.decoder.ErrorCorrectionLevel# L 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: letv   文件: QRCodeWriter.java

public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints) throws WriterException {
    if (contents.length() == 0) {
        throw new IllegalArgumentException("Found empty contents");
    } else if (format != BarcodeFormat.QR_CODE) {
        throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
    } else if (width < 0 || height < 0) {
        throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
    } else {
        ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
        int quietZone = 4;
        if (hints != null) {
            ErrorCorrectionLevel requestedECLevel = (ErrorCorrectionLevel) hints.get(EncodeHintType.ERROR_CORRECTION);
            if (requestedECLevel != null) {
                errorCorrectionLevel = requestedECLevel;
            }
            Integer quietZoneInt = (Integer) hints.get(EncodeHintType.MARGIN);
            if (quietZoneInt != null) {
                quietZone = quietZoneInt.intValue();
            }
        }
        return renderResult(Encoder.encode(contents, errorCorrectionLevel, hints), width, height, quietZone);
    }
}
 
源代码2 项目: MyBox   文件: QRCodeWriter.java

@Override
public BitMatrix encode(String contents,
        BarcodeFormat format,
        int width,
        int height,
        Map<EncodeHintType, ?> hints) throws WriterException {

    if (contents.isEmpty()) {
        throw new IllegalArgumentException("Found empty contents");
    }

    if (format != BarcodeFormat.QR_CODE) {
        throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
    }

    if (width < 0 || height < 0) {
        throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x'
                + height);
    }

    ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
    int quietZone = QUIET_ZONE_SIZE;
    if (hints != null) {
        if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
            errorCorrectionLevel = ErrorCorrectionLevel.valueOf(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
        }
        if (hints.containsKey(EncodeHintType.MARGIN)) {
            quietZone = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
        }
    }

    code = Encoder.encode(contents, errorCorrectionLevel, hints);
    return renderResult(width, height, quietZone);
}
 
源代码3 项目: ScreenCapture   文件: QRCodeWriter.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }

  if (format != BarcodeFormat.QR_CODE) {
    throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
  }

  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' +
        height);
  }

  ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
  int quietZone = QUIET_ZONE_SIZE;
  if (hints != null) {
    if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
      errorCorrectionLevel = ErrorCorrectionLevel.valueOf(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      quietZone = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
    }
  }

  QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
  return renderResult(code, width, height, quietZone);
}
 
源代码4 项目: ShareBox   文件: QRCodeWriter.java

public BitMatrix encode(String contents, int width, int height, Map<EncodeHintType, ?> hints)
        throws WriterException {

    if (contents.isEmpty()) {
        throw new IllegalArgumentException("Found empty contents");
    }

    if (width < 0 || height < 0) {
        throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
    }

    ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
    int quietZone = QUIET_ZONE_SIZE;
    if (hints != null) {
        ErrorCorrectionLevel requestedECLevel = (ErrorCorrectionLevel) hints.get(EncodeHintType.ERROR_CORRECTION);
        if (requestedECLevel != null) {
            errorCorrectionLevel = requestedECLevel;
        }
        Integer quietZoneInt = (Integer) hints.get(EncodeHintType.MARGIN);
        if (quietZoneInt != null) {
            quietZone = quietZoneInt;
        }
    }

    QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
    return renderResult(code, width, height, quietZone);
}
 

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }

  if (format != BarcodeFormat.QR_CODE) {
    throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
  }

  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' +
        height);
  }

  ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
  int quietZone = QUIET_ZONE_SIZE;
  if (hints != null) {
    if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
      errorCorrectionLevel = ErrorCorrectionLevel.valueOf(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      quietZone = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
    }
  }

  QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
  return renderResult(code, width, height, quietZone);
}
 
源代码6 项目: QrCodeScanner   文件: QRCodeWriter.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }

  if (format != BarcodeFormat.QR_CODE) {
    throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
  }

  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' +
        height);
  }

  ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
  int quietZone = QUIET_ZONE_SIZE;
  if (hints != null) {
    if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
      errorCorrectionLevel = ErrorCorrectionLevel.valueOf(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      quietZone = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
    }
  }

  QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
  return renderResult(code, width, height, quietZone);
}
 
源代码7 项目: ZXing-Orient   文件: QRCodeWriter.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }

  if (format != BarcodeFormat.QR_CODE) {
    throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
  }

  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' +
        height);
  }

  ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
  int quietZone = QUIET_ZONE_SIZE;
  if (hints != null) {
    ErrorCorrectionLevel requestedECLevel = (ErrorCorrectionLevel) hints.get(EncodeHintType.ERROR_CORRECTION);
    if (requestedECLevel != null) {
      errorCorrectionLevel = requestedECLevel;
    }
    Integer quietZoneInt = (Integer) hints.get(EncodeHintType.MARGIN);
    if (quietZoneInt != null) {
      quietZone = quietZoneInt;
    }
  }

  QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
  return renderResult(code, width, height, quietZone);
}
 

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }

  if (format != BarcodeFormat.QR_CODE) {
    throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
  }

  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' +
        height);
  }

  ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
  int quietZone = QUIET_ZONE_SIZE;
  if (hints != null) {
    if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
      errorCorrectionLevel = ErrorCorrectionLevel.valueOf(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      quietZone = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
    }
  }

  QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
  return renderResult(code, width, height, quietZone);
}
 
源代码9 项目: weex   文件: QRCodeWriter.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }

  if (format != BarcodeFormat.QR_CODE) {
    throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
  }

  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' +
        height);
  }

  ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
  int quietZone = QUIET_ZONE_SIZE;
  if (hints != null) {
    if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
      errorCorrectionLevel = ErrorCorrectionLevel.valueOf(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      quietZone = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
    }
  }

  QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
  return renderResult(code, width, height, quietZone);
}
 

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }

  if (format != BarcodeFormat.QR_CODE) {
    throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
  }

  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' +
        height);
  }

  ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
  int quietZone = QUIET_ZONE_SIZE;
  if (hints != null) {
    if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
      errorCorrectionLevel = ErrorCorrectionLevel.valueOf(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      quietZone = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
    }
  }

  QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
  return renderResult(code, width, height, quietZone);
}
 
源代码11 项目: reacteu-app   文件: QRCodeWriter.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {

  if (contents.length() == 0) {
    throw new IllegalArgumentException("Found empty contents");
  }

  if (format != BarcodeFormat.QR_CODE) {
    throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
  }

  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' +
        height);
  }

  ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
  int quietZone = QUIET_ZONE_SIZE;
  if (hints != null) {
    ErrorCorrectionLevel requestedECLevel = (ErrorCorrectionLevel) hints.get(EncodeHintType.ERROR_CORRECTION);
    if (requestedECLevel != null) {
      errorCorrectionLevel = requestedECLevel;
    }
    Integer quietZoneInt = (Integer) hints.get(EncodeHintType.MARGIN);
    if (quietZoneInt != null) {
      quietZone = quietZoneInt;
    }
  }

  QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
  return renderResult(code, width, height, quietZone);
}
 
源代码12 项目: RipplePower   文件: QRCodeWriter.java

@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints)
		throws WriterException {

	if (contents.isEmpty()) {
		throw new IllegalArgumentException("Found empty contents");
	}

	if (format != BarcodeFormat.QR_CODE) {
		throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format);
	}

	if (width < 0 || height < 0) {
		throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
	}

	ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
	int quietZone = QUIET_ZONE_SIZE;
	if (hints != null) {
		ErrorCorrectionLevel requestedECLevel = (ErrorCorrectionLevel) hints.get(EncodeHintType.ERROR_CORRECTION);
		if (requestedECLevel != null) {
			errorCorrectionLevel = requestedECLevel;
		}
		Integer quietZoneInt = (Integer) hints.get(EncodeHintType.MARGIN);
		if (quietZoneInt != null) {
			quietZone = quietZoneInt;
		}
	}

	QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
	return renderResult(code, width, height, quietZone);
}