com.google.zxing.common.BitMatrix#clear ( )源码实例Demo

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

源代码1 项目: AndroidWallet   文件: QRCodeHelper.java
private static BitMatrix updateBit(BitMatrix matrix, int margin){
    int tempM = margin*2;
    int[] rec = matrix.getEnclosingRectangle();   //获取二维码图案的属性
    int resWidth = rec[2] + tempM;
    int resHeight = rec[3] + tempM;
    BitMatrix resMatrix = new BitMatrix(resWidth, resHeight); // 按照自定义边框生成新的BitMatrix
    resMatrix.clear();
    for(int i= margin; i < resWidth- margin; i++){   //循环,将二维码图案绘制到新的bitMatrix中
        for(int j=margin; j < resHeight-margin; j++){
            if(matrix.get(i-margin + rec[0], j-margin + rec[1])){
                resMatrix.set(i,j);
            }
        }
    }
    return resMatrix;
}
 
源代码2 项目: letv   文件: PDF417Writer.java
private static BitMatrix bitMatrixFrombitArray(byte[][] input) {
    BitMatrix output = new BitMatrix(input[0].length + 60, input.length + 60);
    output.clear();
    int y = 0;
    int yOutput = output.getHeight() - 30;
    while (y < input.length) {
        for (int x = 0; x < input[0].length; x++) {
            if (input[y][x] == (byte) 1) {
                output.set(x + 30, yOutput);
            }
        }
        y++;
        yOutput--;
    }
    return output;
}
 
源代码3 项目: ZXing-Orient   文件: DataMatrixWriter.java
/**
 * 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;
}
 
/**
 * 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;
}
 
源代码5 项目: weex   文件: DataMatrixWriter.java
/**
 * 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;
}
 
源代码6 项目: barcodescanner-lib-aar   文件: DataMatrixWriter.java
/**
 * 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;
}
 
源代码7 项目: reacteu-app   文件: PDF417Writer.java
/**
 * This takes an array holding the values of the PDF 417
 *
 * @param input a byte array of information with 0 is black, and 1 is white
 * @return BitMatrix of the input
 */
private static BitMatrix bitMatrixFrombitArray(byte[][] input) {
  // Creates a small whitespace border around the barcode
  int whiteSpace = 30;

  // Creates the bitmatrix with extra space for whitespace
  BitMatrix output = new BitMatrix(input[0].length + 2 * whiteSpace, input.length + 2 * whiteSpace);
  output.clear();
  for (int y = 0, yOutput = output.getHeight() - whiteSpace; y < input.length; y++, yOutput--) {
    for (int x = 0; x < input[0].length; x++) {
      // Zero is white in the bytematrix
      if (input[y][x] == 1) {
        output.set(x + whiteSpace, yOutput);
      }
    }
  }
  return output;
}
 
源代码8 项目: MiBandDecompiled   文件: PDF417Writer.java
private static BitMatrix a(byte abyte0[][])
{
    BitMatrix bitmatrix = new BitMatrix(60 + abyte0.length, 60 + abyte0[0].length);
    bitmatrix.clear();
    for (int i = 0; i < abyte0.length; i++)
    {
        for (int j = 0; j < abyte0[0].length; j++)
        {
            if (abyte0[i][j] == 1)
            {
                bitmatrix.set(i + 30, j + 30);
            }
        }

    }

    return bitmatrix;
}
 
源代码9 项目: RipplePower   文件: DataMatrixWriter.java
/**
 * 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;
}
 
源代码10 项目: ZXing-Orient   文件: PDF417Writer.java
/**
 * This takes an array holding the values of the PDF 417
 *
 * @param input a byte array of information with 0 is black, and 1 is white
 * @param margin border around the barcode
 * @return BitMatrix of the input
 */
private static BitMatrix bitMatrixFrombitArray(byte[][] input, int margin) {
  // Creates the bitmatrix with extra space for whitespace
  BitMatrix output = new BitMatrix(input[0].length + 2 * margin, input.length + 2 * margin);
  output.clear();
  for (int y = 0, yOutput = output.getHeight() - margin - 1; y < input.length; y++, yOutput--) {
    for (int x = 0; x < input[0].length; x++) {
      // Zero is white in the bytematrix
      if (input[y][x] == 1) {
        output.set(x + margin, yOutput);
      }
    }
  }
  return output;
}
 
/**
 * This takes an array holding the values of the PDF 417
 *
 * @param input a byte array of information with 0 is black, and 1 is white
 * @param margin border around the barcode
 * @return BitMatrix of the input
 */
private static BitMatrix bitMatrixFrombitArray(byte[][] input, int margin) {
  // Creates the bitmatrix with extra space for whitespace
  BitMatrix output = new BitMatrix(input[0].length + 2 * margin, input.length + 2 * margin);
  output.clear();
  for (int y = 0, yOutput = output.getHeight() - margin - 1; y < input.length; y++, yOutput--) {
    for (int x = 0; x < input[0].length; x++) {
      // Zero is white in the bytematrix
      if (input[y][x] == 1) {
        output.set(x + margin, yOutput);
      }
    }
  }
  return output;
}
 
源代码12 项目: weex   文件: PDF417Writer.java
/**
 * This takes an array holding the values of the PDF 417
 *
 * @param input a byte array of information with 0 is black, and 1 is white
 * @param margin border around the barcode
 * @return BitMatrix of the input
 */
private static BitMatrix bitMatrixFrombitArray(byte[][] input, int margin) {
  // Creates the bitmatrix with extra space for whitespace
  BitMatrix output = new BitMatrix(input[0].length + 2 * margin, input.length + 2 * margin);
  output.clear();
  for (int y = 0, yOutput = output.getHeight() - margin - 1; y < input.length; y++, yOutput--) {
    for (int x = 0; x < input[0].length; x++) {
      // Zero is white in the bytematrix
      if (input[y][x] == 1) {
        output.set(x + margin, yOutput);
      }
    }
  }
  return output;
}
 
源代码13 项目: barcodescanner-lib-aar   文件: PDF417Writer.java
/**
 * This takes an array holding the values of the PDF 417
 *
 * @param input a byte array of information with 0 is black, and 1 is white
 * @param margin border around the barcode
 * @return BitMatrix of the input
 */
private static BitMatrix bitMatrixFrombitArray(byte[][] input, int margin) {
  // Creates the bitmatrix with extra space for whitespace
  BitMatrix output = new BitMatrix(input[0].length + 2 * margin, input.length + 2 * margin);
  output.clear();
  for (int y = 0, yOutput = output.getHeight() - margin - 1; y < input.length; y++, yOutput--) {
    for (int x = 0; x < input[0].length; x++) {
      // Zero is white in the bytematrix
      if (input[y][x] == 1) {
        output.set(x + margin, yOutput);
      }
    }
  }
  return output;
}