当前位置: 首页>>代码示例>>Java>>正文


Java SymbolInfo.getSymbolDataWidth方法代码示例

本文整理汇总了Java中com.google.zxing.datamatrix.encoder.SymbolInfo.getSymbolDataWidth方法的典型用法代码示例。如果您正苦于以下问题:Java SymbolInfo.getSymbolDataWidth方法的具体用法?Java SymbolInfo.getSymbolDataWidth怎么用?Java SymbolInfo.getSymbolDataWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.zxing.datamatrix.encoder.SymbolInfo的用法示例。


在下文中一共展示了SymbolInfo.getSymbolDataWidth方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encode

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的package包/类
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height,
                        Map<EncodeHintType, ?> hints) {
    if (contents.isEmpty()) {
        throw new IllegalArgumentException("Found empty contents");
    } else if (format != BarcodeFormat.DATA_MATRIX) {
        throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got " + format);
    } else if (width < 0 || height < 0) {
        throw new IllegalArgumentException("Requested dimensions are too small: " + width +
                'x' + height);
    } else {
        SymbolShapeHint shape = SymbolShapeHint.FORCE_NONE;
        Dimension minSize = null;
        Dimension maxSize = null;
        if (hints != null) {
            SymbolShapeHint requestedShape = (SymbolShapeHint) hints.get(EncodeHintType
                    .DATA_MATRIX_SHAPE);
            if (requestedShape != null) {
                shape = requestedShape;
            }
            Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE);
            if (requestedMinSize != null) {
                minSize = requestedMinSize;
            }
            Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE);
            if (requestedMaxSize != null) {
                maxSize = requestedMaxSize;
            }
        }
        String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize);
        SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize,
                true);
        DefaultPlacement placement = new DefaultPlacement(ErrorCorrection.encodeECC200
                (encoded, symbolInfo), symbolInfo.getSymbolDataWidth(), symbolInfo
                .getSymbolDataHeight());
        placement.place();
        return encodeLowLevel(placement, symbolInfo);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:39,代码来源:DataMatrixWriter.java

示例2: encode

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的package包/类
@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }
  
  if (format != BarcodeFormat.DATA_MATRIX) {
    throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got " + format);
  }
  
  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
  }

  // Try to get force shape & min / max size
  SymbolShapeHint shape = SymbolShapeHint.FORCE_NONE;
  Dimension minSize = null;
  Dimension maxSize = null;
  if (hints != null) {
    SymbolShapeHint requestedShape = (SymbolShapeHint) hints.get(EncodeHintType.DATA_MATRIX_SHAPE);
    if (requestedShape != null) {
      shape = requestedShape;
    }
    Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE);
    if (requestedMinSize != null) {
      minSize = requestedMinSize;
    }
    Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE);
    if (requestedMaxSize != null) {
      maxSize = requestedMaxSize;
    }
  }


  //1. step: Data encodation
  String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize);

  SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize, true);

  //2. step: ECC generation
  String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);

  //3. step: Module placement in Matrix
  DefaultPlacement placement =
      new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
  placement.place();

  //4. step: low-level encoding
  return encodeLowLevel(placement, symbolInfo);
}
 
开发者ID:SudarAbisheck,项目名称:ZXing-Orient,代码行数:52,代码来源:DataMatrixWriter.java

示例3: encode

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的package包/类
@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }
  
  if (format != BarcodeFormat.DATA_MATRIX) {
    throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got " + format);
  }
  
  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
  }

  // Try to get force shape & min / max size
  SymbolShapeHint shape = SymbolShapeHint.FORCE_NONE;
  Dimension minSize = null;
  Dimension maxSize = null;
  if (hints != null) {
    SymbolShapeHint requestedShape = (SymbolShapeHint) hints.get(EncodeHintType.DATA_MATRIX_SHAPE);
    if (requestedShape != null) {
      shape = requestedShape;
    }
    @SuppressWarnings("deprecation")
    Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE);
    if (requestedMinSize != null) {
      minSize = requestedMinSize;
    }
    @SuppressWarnings("deprecation")
    Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE);
    if (requestedMaxSize != null) {
      maxSize = requestedMaxSize;
    }
  }


  //1. step: Data encodation
  String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize);

  SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize, true);

  //2. step: ECC generation
  String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);

  //3. step: Module placement in Matrix
  DefaultPlacement placement =
      new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
  placement.place();

  //4. step: low-level encoding
  return encodeLowLevel(placement, symbolInfo);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:54,代码来源:DataMatrixWriter.java

示例4: encodeLowLevel

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的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);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:56,代码来源:DataMatrixWriter.java

示例5: encodeLowLevel

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:54,代码来源:DataMatrixWriter.java

示例6: encodeLowLevel

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的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);
}
 
开发者ID:Ag47,项目名称:TrueTone,代码行数:56,代码来源:DataMatrixWriter.java

示例7: encode

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的package包/类
@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints) {

    if (contents.isEmpty()) {
        throw new IllegalArgumentException("Found empty contents");
    }

    if (format != BarcodeFormat.DATA_MATRIX) {
        throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got " + format);
    }

    if (width < 0 || height < 0) {
        throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
    }

    // Try to get force shape & min / max size
    SymbolShapeHint shape = SymbolShapeHint.FORCE_NONE;
    Dimension minSize = new Dimension(width, height);
    Dimension maxSize = null;
    if (hints != null) {
        SymbolShapeHint requestedShape = (SymbolShapeHint) hints.get(EncodeHintType.DATA_MATRIX_SHAPE);
        if (requestedShape != null) {
            shape = requestedShape;
        }
        @SuppressWarnings("deprecated")
        Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE);
        if (requestedMinSize != null) {
            minSize = requestedMinSize;
        }
        @SuppressWarnings("deprecated")
        Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE);
        if (requestedMaxSize != null) {
            maxSize = requestedMaxSize;
        }
    }


    //1. step: Data encodation
    String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize);

    SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize, true);

    //2. step: ECC generation
    String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);

    //3. step: Module placement in Matrix
    DefaultPlacement placement =
            new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
    placement.place();

    //4. step: low-level encoding
    return encodeLowLevel(placement, symbolInfo);
}
 
开发者ID:Ag47,项目名称:TrueTone,代码行数:54,代码来源:DataMatrixWriter.java

示例8: encode

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的package包/类
@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints) {

    if (contents.length() == 0) {
        throw new IllegalArgumentException("Found empty contents");
    }

    if (format != BarcodeFormat.DATA_MATRIX) {
        throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got " + format);
    }

    if (width < 0 || height < 0) {
        throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
    }

    // Try to get force shape & min / max size
    SymbolShapeHint shape = SymbolShapeHint.FORCE_NONE;
    Dimension minSize = null;
    Dimension maxSize = null;
    if (hints != null) {
        SymbolShapeHint requestedShape = (SymbolShapeHint) hints.get(EncodeHintType.DATA_MATRIX_SHAPE);
        if (requestedShape != null) {
            shape = requestedShape;
        }
        Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE);
        if (requestedMinSize != null) {
            minSize = requestedMinSize;
        }
        Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE);
        if (requestedMaxSize != null) {
            maxSize = requestedMaxSize;
        }
    }


    //1. step: Data encodation
    String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize);

    SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize, true);

    //2. step: ECC generation
    String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);

    //3. step: Module placement in Matrix
    DefaultPlacement placement =
            new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
    placement.place();

    //4. step: low-level encoding
    return encodeLowLevel(placement, symbolInfo);
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:52,代码来源:DataMatrixWriter.java

示例9: encode

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的package包/类
@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) {

  if (contents.isEmpty()) {
    throw new IllegalArgumentException("Found empty contents");
  }
  
  if (format != BarcodeFormat.DATA_MATRIX) {
    throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got " + format);
  }
  
  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
  }

  // Try to get force shape & min / max size
  SymbolShapeHint shape = SymbolShapeHint.FORCE_NONE;
  Dimension minSize = new Dimension(width, height);
  Dimension maxSize = null;
  if (hints != null) {
    SymbolShapeHint requestedShape = (SymbolShapeHint) hints.get(EncodeHintType.DATA_MATRIX_SHAPE);
    if (requestedShape != null) {
      shape = requestedShape;
    }
    @SuppressWarnings("deprecation")
    Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE);
    if (requestedMinSize != null) {
      minSize = requestedMinSize;
    }
    @SuppressWarnings("deprecation")
    Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE);
    if (requestedMaxSize != null) {
      maxSize = requestedMaxSize;
    }
  }


  //1. step: Data encodation
  String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize);

  SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize, true);

  //2. step: ECC generation
  String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);

  //3. step: Module placement in Matrix
  DefaultPlacement placement =
      new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
  placement.place();

  //4. step: low-level encoding
  return encodeLowLevel(placement, symbolInfo);
}
 
开发者ID:bushidowallet,项目名称:bushido-android-app,代码行数:54,代码来源:DataMatrixWriter.java

示例10: encode

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的package包/类
@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height,
		Map<EncodeHintType, ?> hints) {

	if (contents.isEmpty()) {
		throw new IllegalArgumentException("Found empty contents");
	}

	if (format != BarcodeFormat.DATA_MATRIX) {
		throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got " + format);
	}

	if (width < 0 || height < 0) {
		throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
	}

	// Try to get force shape & min / max size
	SymbolShapeHint shape = SymbolShapeHint.FORCE_NONE;
	Dimension minSize = null;
	Dimension maxSize = null;
	if (hints != null) {
		SymbolShapeHint requestedShape = (SymbolShapeHint) hints.get(EncodeHintType.DATA_MATRIX_SHAPE);
		if (requestedShape != null) {
			shape = requestedShape;
		}
		Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE);
		if (requestedMinSize != null) {
			minSize = requestedMinSize;
		}
		Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE);
		if (requestedMaxSize != null) {
			maxSize = requestedMaxSize;
		}
	}

	// 1. step: Data encodation
	String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize);

	SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize, true);

	// 2. step: ECC generation
	String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);

	// 3. step: Module placement in Matrix
	DefaultPlacement placement = new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(),
			symbolInfo.getSymbolDataHeight());
	placement.place();

	// 4. step: low-level encoding
	return encodeLowLevel(placement, symbolInfo);
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:52,代码来源:DataMatrixWriter.java

示例11: encodeLowLevel

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的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);
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:58,代码来源:DataMatrixWriter.java

示例12: encode

import com.google.zxing.datamatrix.encoder.SymbolInfo; //导入方法依赖的package包/类
@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) {

  if (contents.length() == 0) {
    throw new IllegalArgumentException("Found empty contents");
  }
  
  if (format != BarcodeFormat.DATA_MATRIX) {
    throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got " + format);
  }
  
  if (width < 0 || height < 0) {
    throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height);
  }

  // Try to get force shape & min / max size
  SymbolShapeHint shape = SymbolShapeHint.FORCE_NONE;
  Dimension minSize = null;
  Dimension maxSize = null;
  if (hints != null) {
    SymbolShapeHint requestedShape = (SymbolShapeHint) hints.get(EncodeHintType.DATA_MATRIX_SHAPE);
    if (requestedShape != null) {
      shape = requestedShape;
    }
    Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE);
    if (requestedMinSize != null) {
      minSize = requestedMinSize;
    }
    Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE);
    if (requestedMaxSize != null) {
      maxSize = requestedMaxSize;
    }
  }


  //1. step: Data encodation
  String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize);

  SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize, true);

  //2. step: ECC generation
  String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);

  //3. step: Module placement in Matrix
  DefaultPlacement placement =
      new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
  placement.place();

  //4. step: low-level encoding
  return encodeLowLevel(placement, symbolInfo);
}
 
开发者ID:yinglovezhuzhu,项目名称:ZxingCore,代码行数:52,代码来源:DataMatrixWriter.java


注:本文中的com.google.zxing.datamatrix.encoder.SymbolInfo.getSymbolDataWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。