当前位置: 首页>>代码示例>>Java>>正文


Java BarcodeFormat.ITF属性代码示例

本文整理汇总了Java中com.google.zxing.BarcodeFormat.ITF属性的典型用法代码示例。如果您正苦于以下问题:Java BarcodeFormat.ITF属性的具体用法?Java BarcodeFormat.ITF怎么用?Java BarcodeFormat.ITF使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.zxing.BarcodeFormat的用法示例。


在下文中一共展示了BarcodeFormat.ITF属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encode

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.ITF) {
    throw new IllegalArgumentException("Can only encode ITF, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:12,代码来源:ITFWriter.java

示例2: onItemSelected

/**
 * Generates the chosen format from the spinner menu
 */
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
    String compare = adapterView.getItemAtPosition(position).toString();
    if(compare.equals("BARCODE")){
        format = BarcodeFormat.CODABAR;
    }
    else if(compare.equals("CODE_128")){
        format = BarcodeFormat.CODE_128;
    }
    else if(compare.equals("CODE_39")){
        format = BarcodeFormat.CODE_39;
    }
    else if(compare.equals("EAN_13")){
        format = BarcodeFormat.EAN_13;
    }
    else if(compare.equals("EAN_8")){
        format = BarcodeFormat.EAN_8;
    }
    else if(compare.equals("ITF")){
        format = BarcodeFormat.ITF;
    }
    else if(compare.equals("PDF_417")){
        format = BarcodeFormat.PDF_417;
    }
    else if(compare.equals("UPC_A")){
        format = BarcodeFormat.UPC_A;
    }
}
 
开发者ID:Fr4gorSoftware,项目名称:SecScanQR,代码行数:31,代码来源:BarcodeGenerateActivity.java

示例3: onItemSelected

/**
 * Generates the chosen format from the spinner menu
 */
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    String compare = parent.getItemAtPosition(position).toString();
    if(compare.equals("AZTEC")){
        format = BarcodeFormat.AZTEC;
    }
    else if(compare.equals("CODABAR")){
        format = BarcodeFormat.CODABAR;
    }
    else if(compare.equals("CODE_128")){
        format = BarcodeFormat.CODE_128;
    }
    else if(compare.equals("CODE_39")){
        format = BarcodeFormat.CODE_39;
    }
    else if(compare.equals("EAN_13")){
        format = BarcodeFormat.EAN_13;
    }
    else if(compare.equals("EAN_8")){
        format = BarcodeFormat.EAN_8;
    }
    else if(compare.equals("ITF")){
        format = BarcodeFormat.ITF;
    }
    else if(compare.equals("PDF_417")){
        format = BarcodeFormat.PDF_417;
    }
    else if(compare.equals("QR_CODE")){
        format = BarcodeFormat.QR_CODE;
    }
    else if(compare.equals("UPC_A")){
        format = BarcodeFormat.UPC_A;
    }
}
 
开发者ID:Fr4gorSoftware,项目名称:SecScanQR,代码行数:37,代码来源:GenerateActivity.java

示例4: encode

public BitMatrix encode(String contents, BarcodeFormat format, int width, int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
    if (format == BarcodeFormat.ITF) {
        return super.encode(contents, format, width, height, hints);
    }
    throw new IllegalArgumentException("Can only encode ITF, but got " + format);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:7,代码来源:ITFWriter.java

示例5: decodeRow

public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType, ?> hints) throws
        FormatException, NotFoundException {
    int[] startRange = decodeStart(row);
    int[] endRange = decodeEnd(row);
    StringBuilder result = new StringBuilder(20);
    decodeMiddle(row, startRange[1], endRange[0], result);
    String resultString = result.toString();
    int[] allowedLengths = null;
    if (hints != null) {
        allowedLengths = (int[]) hints.get(DecodeHintType.ALLOWED_LENGTHS);
    }
    if (allowedLengths == null) {
        allowedLengths = DEFAULT_ALLOWED_LENGTHS;
    }
    int length = resultString.length();
    boolean lengthOK = false;
    int maxAllowedLength = 0;
    for (int allowedLength : allowedLengths) {
        if (length == allowedLength) {
            lengthOK = true;
            break;
        }
        if (allowedLength > maxAllowedLength) {
            maxAllowedLength = allowedLength;
        }
    }
    if (!lengthOK && length > maxAllowedLength) {
        lengthOK = true;
    }
    if (lengthOK) {
        return new Result(resultString, null, new ResultPoint[]{new ResultPoint((float)
                startRange[1], (float) rowNumber), new ResultPoint((float) endRange[0],
                (float) rowNumber)}, BarcodeFormat.ITF);
    }
    throw FormatException.getFormatInstance();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:36,代码来源:ITFReader.java

示例6: decodeRow

@Override
public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints)
    throws FormatException, NotFoundException {

  // Find out where the Middle section (payload) starts & ends
  int[] startRange = decodeStart(row);
  int[] endRange = decodeEnd(row);

  StringBuilder result = new StringBuilder(20);
  decodeMiddle(row, startRange[1], endRange[0], result);
  String resultString = result.toString();

  int[] allowedLengths = null;
  if (hints != null) {
    allowedLengths = (int[]) hints.get(DecodeHintType.ALLOWED_LENGTHS);

  }
  if (allowedLengths == null) {
    allowedLengths = DEFAULT_ALLOWED_LENGTHS;
  }

  // To avoid false positives with 2D barcodes (and other patterns), make
  // an assumption that the decoded string must be a 'standard' length if it's short
  int length = resultString.length();
  boolean lengthOK = false;
  int maxAllowedLength = 0;
  for (int allowedLength : allowedLengths) {
    if (length == allowedLength) {
      lengthOK = true;
      break;
    }
    if (allowedLength > maxAllowedLength) {
      maxAllowedLength = allowedLength;
    }
  }
  if (!lengthOK && length > maxAllowedLength) {
    lengthOK = true;
  }
  if (!lengthOK) {
    throw FormatException.getFormatInstance();
  }

  return new Result(
      resultString,
      null, // no natural byte representation for these barcodes
      new ResultPoint[] { new ResultPoint(startRange[1], (float) rowNumber),
                          new ResultPoint(endRange[0], (float) rowNumber)},
      BarcodeFormat.ITF);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:49,代码来源:ITFReader.java

示例7: parseBarCodeString

/**
 * Parse barcodes as BarcodeFormat constants.
 *
 * Supports all iOS codes except [code39mod43, itf14]
 *
 * Additionally supports [codabar, maxicode, rss14, rssexpanded, upca, upceanextension]
 */
private BarcodeFormat parseBarCodeString(String c) {
    if ("aztec".equals(c)) {
        return BarcodeFormat.AZTEC;
    } else if ("ean13".equals(c)) {
        return BarcodeFormat.EAN_13;
    } else if ("ean8".equals(c)) {
        return BarcodeFormat.EAN_8;
    } else if ("qr".equals(c)) {
        return BarcodeFormat.QR_CODE;
    } else if ("pdf417".equals(c)) {
        return BarcodeFormat.PDF_417;
    } else if ("upce".equals(c)) {
        return BarcodeFormat.UPC_E;
    } else if ("datamatrix".equals(c)) {
        return BarcodeFormat.DATA_MATRIX;
    } else if ("code39".equals(c)) {
        return BarcodeFormat.CODE_39;
    } else if ("code93".equals(c)) {
        return BarcodeFormat.CODE_93;
    } else if ("interleaved2of5".equals(c)) {
        return BarcodeFormat.ITF;
    } else if ("codabar".equals(c)) {
        return BarcodeFormat.CODABAR;
    } else if ("code128".equals(c)) {
        return BarcodeFormat.CODE_128;
    } else if ("maxicode".equals(c)) {
        return BarcodeFormat.MAXICODE;
    } else if ("rss14".equals(c)) {
        return BarcodeFormat.RSS_14;
    } else if ("rssexpanded".equals(c)) {
        return BarcodeFormat.RSS_EXPANDED;
    } else if ("upca".equals(c)) {
        return BarcodeFormat.UPC_A;
    } else if ("upceanextension".equals(c)) {
        return BarcodeFormat.UPC_EAN_EXTENSION;
    } else {
        android.util.Log.v("RCTCamera", "Unsupported code.. [" + c + "]");
        return null;
    }
}
 
开发者ID:jonathan68,项目名称:react-native-camera,代码行数:47,代码来源:RCTCameraViewFinder.java

示例8: decodeRow

@Override
public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints)
    throws FormatException, NotFoundException {

  // Find out where the Middle section (payload) starts & ends
  int[] startRange = decodeStart(row);
  int[] endRange = decodeEnd(row);

  StringBuilder result = new StringBuilder(20);
  decodeMiddle(row, startRange[1], endRange[0], result);
  String resultString = result.toString();

  int[] allowedLengths = null;
  if (hints != null) {
    allowedLengths = (int[]) hints.get(DecodeHintType.ALLOWED_LENGTHS);

  }
  if (allowedLengths == null) {
    allowedLengths = DEFAULT_ALLOWED_LENGTHS;
  }

  // To avoid false positives with 2D barcodes (and other patterns), make
  // an assumption that the decoded string must be a 'standard' length if it's short
  int length = resultString.length();
  boolean lengthOK = false;
  int maxAllowedLength = 0;
  for (int allowedLength : allowedLengths) {
    if (length == allowedLength) {
      lengthOK = true;
      break;
    }
    if (allowedLength > maxAllowedLength) {
      maxAllowedLength = allowedLength;
    }
  }
  if (!lengthOK && length > maxAllowedLength) {
    lengthOK = true;
  }
  if (!lengthOK) {
    throw FormatException.getFormatInstance();
  }

  return new Result(
      resultString,
      null, // no natural byte representation for these barcodes
      new ResultPoint[] { new ResultPoint(startRange[1], rowNumber),
                          new ResultPoint(endRange[0], rowNumber)},
      BarcodeFormat.ITF);
}
 
开发者ID:10045125,项目名称:QrCode,代码行数:49,代码来源:ITFReader.java

示例9: decodeRow

@Override
public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints)
    throws FormatException, NotFoundException {

  // Find out where the Middle section (payload) starts & ends
  int[] startRange = decodeStart(row);
  int[] endRange = decodeEnd(row);

  StringBuilder result = new StringBuilder(20);
  decodeMiddle(row, startRange[1], endRange[0], result);
  String resultString = result.toString();

  int[] allowedLengths = null;
  if (hints != null) {
    allowedLengths = (int[]) hints.get(DecodeHintType.ALLOWED_LENGTHS);

  }
  if (allowedLengths == null) {
    allowedLengths = DEFAULT_ALLOWED_LENGTHS;
  }

  // To avoid false positives with 2D barcodes (and other patterns), make
  // an assumption that the decoded string must be a 'standard' length if it's short
  int length = resultString.length();
  boolean lengthOK = false;
  int maxAllowedLength = 0;
  for (int allowedLength : allowedLengths) {
    if (length == allowedLength) {
      lengthOK = true;
      break;
    }
    if (allowedLength > maxAllowedLength) {
      maxAllowedLength = allowedLength;
    }
  }
  if (!lengthOK && length > maxAllowedLength) {
    lengthOK = true;
  }
  if (!lengthOK) {
    throw FormatException.getFormatInstance();
  }

  return new Result(
      resultString,
      null, // no natural byte representation for these barcodes
      new ResultPoint[] {new ResultPoint(startRange[1], rowNumber),
                         new ResultPoint(endRange[0], rowNumber)},
      BarcodeFormat.ITF);
}
 
开发者ID:simplezhli,项目名称:Tesseract-OCR-Scanner,代码行数:49,代码来源:ITFReader.java


注:本文中的com.google.zxing.BarcodeFormat.ITF属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。