本文整理汇总了Java中com.google.zxing.qrcode.encoder.ByteMatrix.set方法的典型用法代码示例。如果您正苦于以下问题:Java ByteMatrix.set方法的具体用法?Java ByteMatrix.set怎么用?Java ByteMatrix.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.qrcode.encoder.ByteMatrix
的用法示例。
在下文中一共展示了ByteMatrix.set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBitMatrix
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static ByteMatrix getBitMatrix(String contents) {
try {
QRCode qrCode = getProtoQRCode(contents, ErrorCorrectionLevel.H);
int agnCenter[] = qrCode.getVersion().getAlignmentPatternCenters();
ByteMatrix byteMatrix = qrCode.getMatrix();
int matSize = byteMatrix.getWidth();
for (int row = 0; row < matSize; row++) {
for (int col = 0; col < matSize; col++) {
if (isTypeAGN(col, row, agnCenter, true)) {
if (byteMatrix.get(col, row) != BYTE_EPT) {
byteMatrix.set(col, row, BYTE_AGN);
} else {
byteMatrix.set(col, row, BYTE_PTC);
}
} else if (isTypePOS(col, row, matSize, true)) {
if (byteMatrix.get(col, row) != BYTE_EPT) {
byteMatrix.set(col, row, BYTE_POS);
} else {
byteMatrix.set(col, row, BYTE_PTC);
}
} else if (isTypeTMG(col, row, matSize)) {
if (byteMatrix.get(col, row) != BYTE_EPT) {
byteMatrix.set(col, row, BYTE_TMG);
} else {
byteMatrix.set(col, row, BYTE_PTC);
}
}
if (isTypePOS(col, row, matSize, false)) {
if (byteMatrix.get(col, row) == BYTE_EPT) {
byteMatrix.set(col, row, BYTE_PTC);
}
}
}
}
return byteMatrix;
} catch (WriterException e) {
e.printStackTrace();
}
return null;
}
示例2: encodeLowLevel
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
/**
* Encode the given symbol info to a bit matrix.
*
* @param placement The DataMatrix placement.
* @param symbolInfo The symbol info to encode.
* @return The bit matrix generated.
*/
private static BitMatrix encodeLowLevel(DefaultPlacement placement, SymbolInfo symbolInfo) {
int symbolWidth = symbolInfo.getSymbolDataWidth();
int symbolHeight = symbolInfo.getSymbolDataHeight();
ByteMatrix matrix = new ByteMatrix(symbolInfo.getSymbolWidth(), symbolInfo.getSymbolHeight());
int matrixY = 0;
for (int y = 0; y < symbolHeight; y++) {
// Fill the top edge with alternate 0 / 1
int matrixX;
if ((y % symbolInfo.matrixHeight) == 0) {
matrixX = 0;
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
matrix.set(matrixX, matrixY, (x % 2) == 0);
matrixX++;
}
matrixY++;
}
matrixX = 0;
for (int x = 0; x < symbolWidth; x++) {
// Fill the right edge with full 1
if ((x % symbolInfo.matrixWidth) == 0) {
matrix.set(matrixX, matrixY, true);
matrixX++;
}
matrix.set(matrixX, matrixY, placement.getBit(x, y));
matrixX++;
// Fill the right edge with alternate 0 / 1
if ((x % symbolInfo.matrixWidth) == symbolInfo.matrixWidth - 1) {
matrix.set(matrixX, matrixY, (y % 2) == 0);
matrixX++;
}
}
matrixY++;
// Fill the bottom edge with full 1
if ((y % symbolInfo.matrixHeight) == symbolInfo.matrixHeight - 1) {
matrixX = 0;
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
matrix.set(matrixX, matrixY, true);
matrixX++;
}
matrixY++;
}
}
return convertByteMatrixToBitMatrix(matrix);
}
示例3: encodeLowLevel
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix encodeLowLevel(DefaultPlacement placement, SymbolInfo symbolInfo) {
int symbolWidth = symbolInfo.getSymbolDataWidth();
int symbolHeight = symbolInfo.getSymbolDataHeight();
ByteMatrix matrix = new ByteMatrix(symbolInfo.getSymbolWidth(), symbolInfo
.getSymbolHeight());
int matrixY = 0;
for (int y = 0; y < symbolHeight; y++) {
int matrixX;
int x;
boolean z;
if (y % symbolInfo.matrixHeight == 0) {
matrixX = 0;
for (x = 0; x < symbolInfo.getSymbolWidth(); x++) {
if (x % 2 == 0) {
z = true;
} else {
z = false;
}
matrix.set(matrixX, matrixY, z);
matrixX++;
}
matrixY++;
}
matrixX = 0;
for (x = 0; x < symbolWidth; x++) {
if (x % symbolInfo.matrixWidth == 0) {
matrix.set(matrixX, matrixY, true);
matrixX++;
}
matrix.set(matrixX, matrixY, placement.getBit(x, y));
matrixX++;
if (x % symbolInfo.matrixWidth == symbolInfo.matrixWidth - 1) {
if (y % 2 == 0) {
z = true;
} else {
z = false;
}
matrix.set(matrixX, matrixY, z);
matrixX++;
}
}
matrixY++;
if (y % symbolInfo.matrixHeight == symbolInfo.matrixHeight - 1) {
matrixX = 0;
for (x = 0; x < symbolInfo.getSymbolWidth(); x++) {
matrix.set(matrixX, matrixY, true);
matrixX++;
}
matrixY++;
}
}
return convertByteMatrixToBitMatrix(matrix);
}
示例4: encodeLowLevel
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
/**
* Encode the given symbol info to a bit matrix.
*
* @param placement The DataMatrix placement.
* @param symbolInfo The symbol info to encode.
* @return The bit matrix generated.
*/
private static BitMatrix encodeLowLevel(DefaultPlacement placement, SymbolInfo symbolInfo) {
int symbolWidth = symbolInfo.getSymbolDataWidth();
int symbolHeight = symbolInfo.getSymbolDataHeight();
ByteMatrix matrix = new ByteMatrix(symbolInfo.getSymbolWidth(), symbolInfo.getSymbolHeight());
int matrixY = 0;
for (int y = 0; y < symbolHeight; y++) {
// Fill the top edge with alternate 0 / 1
int matrixX;
if ((y % symbolInfo.matrixHeight) == 0) {
matrixX = 0;
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
matrix.set(matrixX, matrixY, (x % 2) == 0);
matrixX++;
}
matrixY++;
}
matrixX = 0;
for (int x = 0; x < symbolWidth; x++) {
// Fill the right edge with full 1
if ((x % symbolInfo.matrixWidth) == 0) {
matrix.set(matrixX, matrixY, true);
matrixX++;
}
matrix.set(matrixX, matrixY, placement.getBit(x, y));
matrixX++;
// Fill the right edge with alternate 0 / 1
if ((x % symbolInfo.matrixWidth) == symbolInfo.matrixWidth - 1) {
matrix.set(matrixX, matrixY, (y % 2) == 0);
matrixX++;
}
}
matrixY++;
// Fill the bottom edge with full 1
if ((y % symbolInfo.matrixHeight) == symbolInfo.matrixHeight - 1) {
matrixX = 0;
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
matrix.set(matrixX, matrixY, true);
matrixX++;
}
matrixY++;
}
}
return convertByteMatrixToBitMatrix(matrix);
}
示例5: encodeLowLevel
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
/**
* Encode the given symbol info to a bit matrix.
*
* @param placement
* The DataMatrix placement.
* @param symbolInfo
* The symbol info to encode.
* @return The bit matrix generated.
*/
private static BitMatrix encodeLowLevel(DefaultPlacement placement, SymbolInfo symbolInfo) {
int symbolWidth = symbolInfo.getSymbolDataWidth();
int symbolHeight = symbolInfo.getSymbolDataHeight();
ByteMatrix matrix = new ByteMatrix(symbolInfo.getSymbolWidth(), symbolInfo.getSymbolHeight());
int matrixY = 0;
for (int y = 0; y < symbolHeight; y++) {
// Fill the top edge with alternate 0 / 1
int matrixX;
if ((y % symbolInfo.matrixHeight) == 0) {
matrixX = 0;
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
matrix.set(matrixX, matrixY, (x % 2) == 0);
matrixX++;
}
matrixY++;
}
matrixX = 0;
for (int x = 0; x < symbolWidth; x++) {
// Fill the right edge with full 1
if ((x % symbolInfo.matrixWidth) == 0) {
matrix.set(matrixX, matrixY, true);
matrixX++;
}
matrix.set(matrixX, matrixY, placement.getBit(x, y));
matrixX++;
// Fill the right edge with alternate 0 / 1
if ((x % symbolInfo.matrixWidth) == symbolInfo.matrixWidth - 1) {
matrix.set(matrixX, matrixY, (y % 2) == 0);
matrixX++;
}
}
matrixY++;
// Fill the bottom edge with full 1
if ((y % symbolInfo.matrixHeight) == symbolInfo.matrixHeight - 1) {
matrixX = 0;
for (int x = 0; x < symbolInfo.getSymbolWidth(); x++) {
matrix.set(matrixX, matrixY, true);
matrixX++;
}
matrixY++;
}
}
return convertByteMatrixToBitMatrix(matrix);
}