本文整理汇总了Java中com.google.zxing.qrcode.encoder.ByteMatrix.get方法的典型用法代码示例。如果您正苦于以下问题:Java ByteMatrix.get方法的具体用法?Java ByteMatrix.get怎么用?Java ByteMatrix.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.qrcode.encoder.ByteMatrix
的用法示例。
在下文中一共展示了ByteMatrix.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertByteMatrixToBitMatrix
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
/**
* Convert the ByteMatrix to BitMatrix.
*
* @param matrix The input matrix.
* @return The output matrix.
*/
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix) {
int matrixWidgth = matrix.getWidth();
int matrixHeight = matrix.getHeight();
BitMatrix output = new BitMatrix(matrixWidgth, matrixHeight);
output.clear();
for (int i = 0; i < matrixWidgth; i++) {
for (int j = 0; j < matrixHeight; j++) {
// Zero is white in the bytematrix
if (matrix.get(i, j) == 1) {
output.set(i, j);
}
}
}
return output;
}
示例2: convertByteMatrixToBitMatrix
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
/**
* Convert the ByteMatrix to BitMatrix.
*
* @param matrix The input matrix.
* @return The output matrix.
*/
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix) {
int matrixWidgth = matrix.getWidth();
int matrixHeight = matrix.getHeight();
BitMatrix output = new BitMatrix(matrixWidgth, matrixHeight);
output.clear();
for (int i = 0; i < matrixWidgth; i++) {
for (int j = 0; j < matrixHeight; j++) {
// Zero is white in the bytematrix
if (matrix.get(i, j) == 1) {
output.set(i, j);
}
}
}
return output;
}
示例3: convertByteMatrixToBitMatrix
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
/**
* Convert the ByteMatrix to BitMatrix.
*
* @param matrix
* The input matrix.
* @return The output matrix.
*/
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix) {
int matrixWidgth = matrix.getWidth();
int matrixHeight = matrix.getHeight();
BitMatrix output = new BitMatrix(matrixWidgth, matrixHeight);
output.clear();
for (int i = 0; i < matrixWidgth; i++) {
for (int j = 0; j < matrixHeight; j++) {
// Zero is white in the bytematrix
if (matrix.get(i, j) == 1) {
output.set(i, j);
}
}
}
return output;
}
示例4: drawQRCodeRect
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private void drawQRCodeRect(Canvas canvas, ByteMatrix input, Rect qrRegionRect, int multiple
, int qrWidth, int qrHeight, Paint paint) {
Rect qrBox = new Rect();
int r = (int) (multiple * 0.4);
for (int inputY = 0, outputY = qrRegionRect.top; inputY < qrHeight; inputY++, outputY += multiple) {
for (int inputX = 0, outputX = qrRegionRect.left; inputX < qrWidth; inputX++, outputX += multiple) {
qrBox.left = outputX;
qrBox.right = outputX + multiple;
qrBox.top = outputY;
qrBox.bottom = outputY + multiple;
if (input.get(inputX, inputY) == 1) {
// canvas.drawRect(new Rect(outputX, outputY, outputX + multiple, outputY + multiple), paint);
drawRoundRect(canvas, new RectF(outputX, outputY, outputX + multiple, outputY + multiple), paint, r
, (isSet(input, inputX - 1, inputY - 1) || isSet(input, inputX, inputY - 1) || isSet(input, inputX - 1, inputY))
, (isSet(input, inputX, inputY - 1) || isSet(input, inputX + 1, inputY - 1) || isSet(input, inputX + 1, inputY))
, (isSet(input, inputX, inputY + 1) || isSet(input, inputX, inputY - 1) || isSet(input, inputX - 1, inputY))
, (isSet(input, inputX + 1, inputY) || isSet(input, inputX + 1, inputY + 1) || isSet(input, inputX, inputY + 1)));
}
}
}
}
示例5: renderResult
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone) {
ByteMatrix input = code.getMatrix();
if (input == null) {
throw new IllegalStateException();
}
int inputWidth = input.getWidth();
int inputHeight = input.getHeight();
int qrWidth = inputWidth + (quietZone * 2);
int qrHeight = inputHeight + (quietZone * 2);
int outputWidth = Math.max(width, qrWidth);
int outputHeight = Math.max(height, qrHeight);
int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight);
// Padding includes both the quiet zone and the extra white pixels to accommodate the requested
// dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
// If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
// handle all the padding from 100x100 (the actual QR) up to 200x160.
int leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
int topPadding = (outputHeight - (inputHeight * multiple)) / 2;
BitMatrix output = new BitMatrix(outputWidth, outputHeight);
for (int inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
// Write the contents of this row of the barcode
for (int inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
if (input.get(inputX, inputY) == 1) {
output.setRegion(outputX, outputY, multiple, multiple);
}
}
}
return output;
}
示例6: renderResult
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone) {
ByteMatrix input = code.getMatrix();
if (input == null) {
throw new IllegalStateException();
}
int inputWidth = input.getWidth();
int inputHeight = input.getHeight();
int qrWidth = inputWidth + (quietZone << 1);
int qrHeight = inputHeight + (quietZone << 1);
int outputWidth = Math.max(width, qrWidth);
int outputHeight = Math.max(height, qrHeight);
int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight);
int leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
int topPadding = (outputHeight - (inputHeight * multiple)) / 2;
BitMatrix output = new BitMatrix(outputWidth, outputHeight);
int inputY = 0;
int outputY = topPadding;
while (inputY < inputHeight) {
int inputX = 0;
int outputX = leftPadding;
while (inputX < inputWidth) {
if (input.get(inputX, inputY) == (byte) 1) {
output.setRegion(outputX, outputY, multiple, multiple);
}
inputX++;
outputX += multiple;
}
inputY++;
outputY += multiple;
}
return output;
}
示例7: renderResult
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone) {
ByteMatrix input = code.getMatrix();
if (input == null) {
throw new IllegalStateException();
}
int inputWidth = input.getWidth();
int inputHeight = input.getHeight();
int qrWidth = inputWidth + (quietZone * 2);
int qrHeight = inputHeight + (quietZone * 2);
int outputWidth = Math.max(width, qrWidth);
int outputHeight = Math.max(height, qrHeight);
int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight);
int leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
int topPadding = (outputHeight - (inputHeight * multiple)) / 2;
BitMatrix output = new BitMatrix(outputWidth, outputHeight);
int inputY = 0;
int outputY = topPadding;
while (inputY < inputHeight) {
int inputX = 0;
int outputX = leftPadding;
while (inputX < inputWidth) {
if (input.get(inputX, inputY) == (byte) 1) {
output.setRegion(outputX, outputY, multiple, multiple);
}
inputX++;
outputX += multiple;
}
inputY++;
outputY += multiple;
}
return output;
}
示例8: convertByteMatrixToBitMatrix
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix) {
int matrixWidgth = matrix.getWidth();
int matrixHeight = matrix.getHeight();
BitMatrix output = new BitMatrix(matrixWidgth, matrixHeight);
output.clear();
for (int i = 0; i < matrixWidgth; i++) {
for (int j = 0; j < matrixHeight; j++) {
if (matrix.get(i, j) == (byte) 1) {
output.set(i, j);
}
}
}
return output;
}
示例9: renderResult
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone) {
ByteMatrix input = code.getMatrix();
if (input == null) {
throw new IllegalStateException();
}
int inputWidth = input.getWidth();
int inputHeight = input.getHeight();
int qrWidth = inputWidth + (quietZone << 1);
int qrHeight = inputHeight + (quietZone << 1);
int outputWidth = Math.max(width, qrWidth);
int outputHeight = Math.max(height, qrHeight);
int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight);
// Padding includes both the quiet zone and the extra white pixels to accommodate the requested
// dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
// If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
// handle all the padding from 100x100 (the actual QR) up to 200x160.
int leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
int topPadding = (outputHeight - (inputHeight * multiple)) / 2;
BitMatrix output = new BitMatrix(outputWidth, outputHeight);
for (int inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
// Write the contents of this row of the barcode
for (int inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
if (input.get(inputX, inputY) == 1) {
output.setRegion(outputX, outputY, multiple, multiple);
}
}
}
return output;
}
示例10: renderResult
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone) {
ByteMatrix input = code.getMatrix();
if (input == null) {
throw new IllegalStateException();
}
int inputWidth = input.getWidth();
int inputHeight = input.getHeight();
int qrWidth = inputWidth + (quietZone * 2);
int qrHeight = inputHeight + (quietZone * 2);
int outputWidth = Math.max(width, qrWidth);
int outputHeight = Math.max(height, qrHeight);
int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight);
// Padding includes both the quiet zone and the extra white pixels to accommodate the requested
// dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
// If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
// handle all the padding from 100x100 (the actual QR) up to 200x160.
int leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
int topPadding = (outputHeight - (inputHeight * multiple)) / 2;
BitMatrix output = new BitMatrix(outputWidth, outputHeight);
for (int inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
// Write the contents of this row of the barcode
for (int inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
if (input.get(inputX, inputY) == 1) {
output.setRegion(outputX, outputY, multiple, multiple);
}
}
}
return output;
}
示例11: renderResult
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone) {
ByteMatrix input = code.getMatrix();
if (input == null) {
throw new IllegalStateException();
}
int inputWidth = input.getWidth();
int inputHeight = input.getHeight();
int qrWidth = inputWidth + (quietZone << 1);
int qrHeight = inputHeight + (quietZone << 1);
int outputWidth = Math.max(width, qrWidth);
int outputHeight = Math.max(height, qrHeight);
int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight);
// Padding includes both the quiet zone and the extra white pixels to accommodate the requested
// dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
// If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
// handle all the padding from 100x100 (the actual QR) up to 200x160.
int leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
int topPadding = (outputHeight - (inputHeight * multiple)) / 2;
BitMatrix output = new BitMatrix(outputWidth, outputHeight);
for (int inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
// Write the contents of this row of the barcode
for (int inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
if (input.get(inputX, inputY) == 1) {
output.setRegion(outputX, outputY, multiple, multiple);
}
}
}
return output;
}
示例12: a
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix a(QRCode qrcode, int i, int j)
{
ByteMatrix bytematrix = qrcode.getMatrix();
if (bytematrix == null)
{
throw new IllegalStateException();
}
int k = bytematrix.getWidth();
int l = bytematrix.getHeight();
int i1 = k + 8;
int j1 = l + 8;
int k1 = Math.max(i, i1);
int l1 = Math.max(j, j1);
int i2 = Math.min(k1 / i1, l1 / j1);
int j2 = (k1 - k * i2) / 2;
int k2 = (l1 - l * i2) / 2;
BitMatrix bitmatrix = new BitMatrix(k1, l1);
int l2 = k2;
int l3;
for (int i3 = 0; i3 < l; i3 = l3)
{
int j3 = j2;
for (int k3 = 0; k3 < k;)
{
if (bytematrix.get(k3, i3) == 1)
{
bitmatrix.setRegion(j3, l2, i2, i2);
}
k3++;
j3 += i2;
}
l3 = i3 + 1;
l2 += i2;
}
return bitmatrix;
}
示例13: renderResult
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone) {
ByteMatrix input = code.getMatrix();
if (input == null) {
throw new IllegalStateException();
}
int inputWidth = input.getWidth();
int inputHeight = input.getHeight();
int qrWidth = inputWidth + (quietZone * 2);
int qrHeight = inputHeight + (quietZone * 2);
int outputWidth = Math.max(width, qrWidth);
int outputHeight = Math.max(height, qrHeight);
int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight);
// Padding includes both the quiet zone and the extra white pixels to
// accommodate the requested
// dimensions. For example, if input is 25x25 the QR will be 33x33
// including the quiet zone.
// If the requested size is 200x160, the multiple will be 4, for a QR of
// 132x132. These will
// handle all the padding from 100x100 (the actual QR) up to 200x160.
int leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
int topPadding = (outputHeight - (inputHeight * multiple)) / 2;
BitMatrix output = new BitMatrix(outputWidth, outputHeight);
for (int inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
// Write the contents of this row of the barcode
for (int inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
if (input.get(inputX, inputY) == 1) {
output.setRegion(outputX, outputY, multiple, multiple);
}
}
}
return output;
}
示例14: renderResult
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private static BitMatrix renderResult(QRCode code, int width, int height) {
ByteMatrix input = code.getMatrix();
int inputWidth = input.getWidth();
int inputHeight = input.getHeight();
int qrWidth = inputWidth + (QUIET_ZONE_SIZE << 1);
int qrHeight = inputHeight + (QUIET_ZONE_SIZE << 1);
int outputWidth = Math.max(width, qrWidth);
int outputHeight = Math.max(height, qrHeight);
int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight);
// Padding includes both the quiet zone and the extra white pixels to accommodate the requested
// dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
// If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
// handle all the padding from 100x100 (the actual QR) up to 200x160.
int leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
int topPadding = (outputHeight - (inputHeight * multiple)) / 2;
BitMatrix output = new BitMatrix(outputWidth, outputHeight);
for (int inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
// Write the contents of this row of the barcode
for (int inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
if (input.get(inputX, inputY) == 1) {
output.setRegion(outputX, outputY, multiple, multiple);
}
}
}
return output;
}
示例15: isSet
import com.google.zxing.qrcode.encoder.ByteMatrix; //导入方法依赖的package包/类
private boolean isSet(ByteMatrix matrix, int row, int column) {
if (matrix == null) {
return false;
}
if (row >= matrix.getWidth() || row < 0) return false;
if (column >= matrix.getHeight() || column < 0) return false;
// if (row == -1 || row == matrix.getWidth() || column == -1
// || column == matrix.getHeight()) {
// return false;
// }
//
// int x, y = 0;
// if (row < 0 || column < 0) {
// x = (row + 1 + matrix.getWidth()) % matrix.getWidth();
// y = (column + 1 + matrix.getHeight()) % matrix.getHeight();
// } else if (row > matrix.getWidth() - 1
// || column > matrix.getHeight() - 1) {
// x = (row - 1 + matrix.getWidth()) % matrix.getWidth();
// y = (column - 1 + matrix.getHeight()) % matrix.getHeight();
// } else {
// x = row % matrix.getWidth();
// y = column % matrix.getHeight();
// }
return matrix.get(row, column) == 1;
}