當前位置: 首頁>>代碼示例>>Java>>正文


Java ErrorCorrectionLevel.L屬性代碼示例

本文整理匯總了Java中com.google.zxing.qrcode.decoder.ErrorCorrectionLevel.L屬性的典型用法代碼示例。如果您正苦於以下問題:Java ErrorCorrectionLevel.L屬性的具體用法?Java ErrorCorrectionLevel.L怎麽用?Java ErrorCorrectionLevel.L使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.zxing.qrcode.decoder.ErrorCorrectionLevel的用法示例。


在下文中一共展示了ErrorCorrectionLevel.L屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: encode

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);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:23,代碼來源:QRCodeWriter.java

示例2: getBitmap

/**
 * Returns a bitmap of the QR Code
 */
public Bitmap getBitmap() throws WriterException {
    String eclString = getEcl();
    ErrorCorrectionLevel ecl;

    switch (eclString) {
        case "M":
            ecl = ErrorCorrectionLevel.M;
            break;
        case "Q":
            ecl = ErrorCorrectionLevel.Q;
            break;
        case "H":
            ecl = ErrorCorrectionLevel.H;
            break;
        default:
            ecl = ErrorCorrectionLevel.L;
            break;
    }

    Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class);
    hints.put(EncodeHintType.ERROR_CORRECTION, ecl);

    return getAsQRCodeObject().getSimpleBitmap(foreground, hints);
}
 
開發者ID:areebbeigh,項目名稱:QRCodeUtility,代碼行數:27,代碼來源:HistoryObject.java

示例3: encode

@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);
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:34,代碼來源:QRCodeWriter.java

示例4: encode

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");
    } 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);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:27,代碼來源:QRCodeWriter.java

示例5: encode

@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);
}
 
開發者ID:SudarAbisheck,項目名稱:ZXing-Orient,代碼行數:36,代碼來源:QRCodeWriter.java

示例6: getEcLevel

/**
 * This method is required and is coded funny because XING - the library we're using,
 * decided not to use enum's for the ec levels because they wanted to support 
 * jdk 1.4 which doesn't have enums. As a result we manuallt valueOf the property.
 * 
 * We need to return the static instances just in case XING decided to do what java-enums
 * do when checking equality - which is to check the in memory class instance value since 
 * enums are defined as singletons.
 */
private static ErrorCorrectionLevel getEcLevel() {
	String ecLevelString=OscarProperties.getInstance().getProperty("QR_CODE_ERROR_CORRECTION_LEVEL");

	if ("L".equals(ecLevelString)) return(ErrorCorrectionLevel.L);
	if ("M".equals(ecLevelString)) return(ErrorCorrectionLevel.M);
	if ("Q".equals(ecLevelString)) return(ErrorCorrectionLevel.Q);
	if ("H".equals(ecLevelString)) return(ErrorCorrectionLevel.H);
	
	return null;
   }
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:19,代碼來源:PrescriptionQrCodeUIBean.java

示例7: encode

@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);
}
 
開發者ID:atomsheep,項目名稱:sres-app,代碼行數:36,代碼來源:QRCodeWriter.java


注:本文中的com.google.zxing.qrcode.decoder.ErrorCorrectionLevel.L屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。