本文整理汇总了Java中com.google.zxing.qrcode.decoder.Version.getVersionNumber方法的典型用法代码示例。如果您正苦于以下问题:Java Version.getVersionNumber方法的具体用法?Java Version.getVersionNumber怎么用?Java Version.getVersionNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.qrcode.decoder.Version
的用法示例。
在下文中一共展示了Version.getVersionNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: maybeEmbedVersionInfo
import com.google.zxing.qrcode.decoder.Version; //导入方法依赖的package包/类
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: maybeEmbedPositionAdjustmentPatterns
import com.google.zxing.qrcode.decoder.Version; //导入方法依赖的package包/类
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);
}
}
}
}
示例3: maybeEmbedPositionAdjustmentPatterns
import com.google.zxing.qrcode.decoder.Version; //导入方法依赖的package包/类
private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
if (version.getVersionNumber() >= 2) {
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 || !isEmpty(matrix.get(x, y)))) {
embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
}
}
}
}
}
示例4: maybeEmbedPositionAdjustmentPatterns
import com.google.zxing.qrcode.decoder.Version; //导入方法依赖的package包/类
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: maybeEmbedVersionInfo
import com.google.zxing.qrcode.decoder.Version; //导入方法依赖的package包/类
static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
if (version.getVersionNumber() >= 7) {
BitArray versionInfoBits = new BitArray();
makeVersionInfoBits(version, versionInfoBits);
int bitIndex = 17;
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 3; j++) {
boolean bit = versionInfoBits.get(bitIndex);
bitIndex--;
matrix.set(i, (matrix.getHeight() - 11) + j, bit);
matrix.set((matrix.getHeight() - 11) + j, i, bit);
}
}
}
}