本文整理匯總了Java中com.google.zxing.common.BitMatrix.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java BitMatrix.clear方法的具體用法?Java BitMatrix.clear怎麽用?Java BitMatrix.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.zxing.common.BitMatrix
的用法示例。
在下文中一共展示了BitMatrix.clear方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateBit
import com.google.zxing.common.BitMatrix; //導入方法依賴的package包/類
/**
* Get BitMatrix
*
* @param matrix BitMatrix
* @param margin margin
* @return BitMatrix
*/
public static BitMatrix updateBit(BitMatrix matrix, int margin) {
int tempM = margin * 2;
int[] rec = matrix.getEnclosingRectangle(); //Gets the properties of the two-dimensional code pattern
int resWidth = rec[2] + tempM;
int resHeight = rec[3] + tempM;
BitMatrix resMatrix = new BitMatrix(resWidth, resHeight); //Generates a new BitMatrix according to the custom borders
resMatrix.clear();
for (int i = margin; i < resWidth - margin; i++) { //Loop to draw the 2D code pattern into the new 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: convertByteMatrixToBitMatrix
import com.google.zxing.common.BitMatrix; //導入方法依賴的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: bitMatrixFrombitArray
import com.google.zxing.common.BitMatrix; //導入方法依賴的package包/類
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;
}
示例4: bitMatrixFrombitArray
import com.google.zxing.common.BitMatrix; //導入方法依賴的package包/類
private static BitMatrix bitMatrixFrombitArray(byte[][] input, int margin) {
BitMatrix output = new BitMatrix(input[0].length + (margin * 2), input.length + (margin *
2));
output.clear();
int y = 0;
int yOutput = (output.getHeight() - margin) - 1;
while (y < input.length) {
for (int x = 0; x < input[0].length; x++) {
if (input[y][x] == (byte) 1) {
output.set(x + margin, yOutput);
}
}
y++;
yOutput--;
}
return output;
}
示例5: bitMatrixFrombitArray
import com.google.zxing.common.BitMatrix; //導入方法依賴的package包/類
/**
* 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;
}
示例6: deleteWhite
import com.google.zxing.common.BitMatrix; //導入方法依賴的package包/類
public static BitMatrix deleteWhite(BitMatrix matrix){
int[] rec = matrix.getEnclosingRectangle();
int resWidth = rec[2] + 1;
int resHeight = rec[3] + 1;
BitMatrix resMatrix = new BitMatrix(resWidth, resHeight);
resMatrix.clear();
for (int i = 0; i < resWidth; i++) {
for (int j = 0; j < resHeight; j++) {
if (matrix.get(i + rec[0], j + rec[1]))
resMatrix.set(i, j);
}
}
return resMatrix;
}
示例7: convertByteMatrixToBitMatrix
import com.google.zxing.common.BitMatrix; //導入方法依賴的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;
}