com.google.zxing.qrcode.decoder.Version# getVersionNumber ( ) 源码实例Demo

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

源代码1 项目: ScreenCapture   文件: MatrixUtil.java

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码2 项目: Telegram   文件: MatrixUtil.java

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
  if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
    return;
  }
  int index = version.getVersionNumber() - 1;
  int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  for (int y : coordinates) {
    if (y >= 0) {
      for (int x : coordinates) {
        if (x >= 0 && isEmpty(matrix.get(x, y))) {
          // If the cell is unset, we embed the position adjustment pattern here.
          // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
          // left top corner.
          embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
        }
      }
    }
  }
}
 

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
  if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
    return;
  }
  int index = version.getVersionNumber() - 1;
  int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  for (int y : coordinates) {
    if (y >= 0) {
      for (int x : coordinates) {
        if (x >= 0 && isEmpty(matrix.get(x, y))) {
          // If the cell is unset, we embed the position adjustment pattern here.
          // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
          // left top corner.
          embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
        }
      }
    }
  }
}
 
源代码5 项目: QrCodeScanner   文件: MatrixUtil.java

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码6 项目: QrCodeScanner   文件: MatrixUtil.java

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
  if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
    return;
  }
  int index = version.getVersionNumber() - 1;
  int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  for (int y : coordinates) {
    if (y >= 0) {
      for (int x : coordinates) {
        if (x >= 0 && isEmpty(matrix.get(x, y))) {
          // If the cell is unset, we embed the position adjustment pattern here.
          // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
          // left top corner.
          embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
        }
      }
    }
  }
}
 
源代码7 项目: ZXing-Orient   文件: MatrixUtil.java

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码8 项目: ZXing-Orient   文件: MatrixUtil.java

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
  if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
    return;
  }
  int index = version.getVersionNumber() - 1;
  int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  int numCoordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index].length;
  for (int i = 0; i < numCoordinates; ++i) {
    for (int j = 0; j < numCoordinates; ++j) {
      int y = coordinates[i];
      int x = coordinates[j];
      if (x == -1 || y == -1) {
        continue;
      }
      // If the cell is unset, we embed the position adjustment pattern here.
      if (isEmpty(matrix.get(x, y))) {
        // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
        // left top corner.
        embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
      }
    }
  }
}
 

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
  if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
    return;
  }
  int index = version.getVersionNumber() - 1;
  int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  int numCoordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index].length;
  for (int i = 0; i < numCoordinates; ++i) {
    for (int j = 0; j < numCoordinates; ++j) {
      int y = coordinates[i];
      int x = coordinates[j];
      if (x == -1 || y == -1) {
        continue;
      }
      // If the cell is unset, we embed the position adjustment pattern here.
      if (isEmpty(matrix.get(x, y))) {
        // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
        // left top corner.
        embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
      }
    }
  }
}
 
源代码11 项目: weex   文件: MatrixUtil.java

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码12 项目: weex   文件: MatrixUtil.java

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
  if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
    return;
  }
  int index = version.getVersionNumber() - 1;
  int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  int numCoordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index].length;
  for (int i = 0; i < numCoordinates; ++i) {
    for (int j = 0; j < numCoordinates; ++j) {
      int y = coordinates[i];
      int x = coordinates[j];
      if (x == -1 || y == -1) {
        continue;
      }
      // If the cell is unset, we embed the position adjustment pattern here.
      if (isEmpty(matrix.get(x, y))) {
        // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
        // left top corner.
        embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
      }
    }
  }
}
 
源代码13 项目: barcodescanner-lib-aar   文件: MatrixUtil.java

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码14 项目: barcodescanner-lib-aar   文件: MatrixUtil.java

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
  if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
    return;
  }
  int index = version.getVersionNumber() - 1;
  int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  int numCoordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index].length;
  for (int i = 0; i < numCoordinates; ++i) {
    for (int j = 0; j < numCoordinates; ++j) {
      int y = coordinates[i];
      int x = coordinates[j];
      if (x == -1 || y == -1) {
        continue;
      }
      // If the cell is unset, we embed the position adjustment pattern here.
      if (isEmpty(matrix.get(x, y))) {
        // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
        // left top corner.
        embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
      }
    }
  }
}
 
源代码15 项目: reacteu-app   文件: MatrixUtil.java

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码16 项目: reacteu-app   文件: MatrixUtil.java

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
  if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
    return;
  }
  int index = version.getVersionNumber() - 1;
  int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  int numCoordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index].length;
  for (int i = 0; i < numCoordinates; ++i) {
    for (int j = 0; j < numCoordinates; ++j) {
      int y = coordinates[i];
      int x = coordinates[j];
      if (x == -1 || y == -1) {
        continue;
      }
      // If the cell is unset, we embed the position adjustment pattern here.
      if (isEmpty(matrix.get(x, y))) {
        // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
        // left top corner.
        embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
      }
    }
  }
}
 
源代码17 项目: RipplePower   文件: MatrixUtil.java

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
	if (version.getVersionNumber() < 7) { // Version info is necessary if
											// version >= 7.
		return; // Don't need version info.
	}
	BitArray versionInfoBits = new BitArray();
	makeVersionInfoBits(version, versionInfoBits);

	int bitIndex = 6 * 3 - 1; // It will decrease from 17 to 0.
	for (int i = 0; i < 6; ++i) {
		for (int j = 0; j < 3; ++j) {
			// Place bits in LSB (least significant bit) to MSB order.
			boolean bit = versionInfoBits.get(bitIndex);
			bitIndex--;
			// Left bottom corner.
			matrix.set(i, matrix.getHeight() - 11 + j, bit);
			// Right bottom corner.
			matrix.set(matrix.getHeight() - 11 + j, i, bit);
		}
	}
}
 
源代码18 项目: RipplePower   文件: MatrixUtil.java

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
	if (version.getVersionNumber() < 2) { // The patterns appear if version
											// >= 2
		return;
	}
	int index = version.getVersionNumber() - 1;
	int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
	int numCoordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index].length;
	for (int i = 0; i < numCoordinates; ++i) {
		for (int j = 0; j < numCoordinates; ++j) {
			int y = coordinates[i];
			int x = coordinates[j];
			if (x == -1 || y == -1) {
				continue;
			}
			// If the cell is unset, we embed the position adjustment
			// pattern here.
			if (isEmpty(matrix.get(x, y))) {
				// -2 is necessary since the x/y coordinates point to the
				// center of the pattern, not the
				// left top corner.
				embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
			}
		}
	}
}
 
源代码19 项目: Telegram-FOSS   文件: MatrixUtil.java

static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码20 项目: Telegram-FOSS   文件: MatrixUtil.java

private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
  if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
    return;
  }
  int index = version.getVersionNumber() - 1;
  int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  for (int y : coordinates) {
    if (y >= 0) {
      for (int x : coordinates) {
        if (x >= 0 && isEmpty(matrix.get(x, y))) {
          // If the cell is unset, we embed the position adjustment pattern here.
          // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
          // left top corner.
          embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
        }
      }
    }
  }
}