本文整理汇总了Java中com.google.zxing.pdf417.encoder.Dimensions类的典型用法代码示例。如果您正苦于以下问题:Java Dimensions类的具体用法?Java Dimensions怎么用?Java Dimensions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dimensions类属于com.google.zxing.pdf417.encoder包,在下文中一共展示了Dimensions类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encode
import com.google.zxing.pdf417.encoder.Dimensions; //导入依赖的package包/类
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height,
Map<EncodeHintType, ?> hints) throws WriterException {
if (format != BarcodeFormat.PDF_417) {
throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
}
PDF417 encoder = new PDF417();
int margin = 30;
int errorCorrectionLevel = 2;
if (hints != null) {
if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
encoder.setCompact(((Boolean) hints.get(EncodeHintType.PDF417_COMPACT))
.booleanValue());
}
if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
encoder.setCompaction((Compaction) hints.get(EncodeHintType.PDF417_COMPACTION));
}
if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
encoder.setDimensions(dimensions.getMaxCols(), dimensions.getMinCols(),
dimensions.getMaxRows(), dimensions.getMinRows());
}
if (hints.containsKey(EncodeHintType.MARGIN)) {
margin = ((Number) hints.get(EncodeHintType.MARGIN)).intValue();
}
if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
errorCorrectionLevel = ((Number) hints.get(EncodeHintType.ERROR_CORRECTION))
.intValue();
}
if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
encoder.setEncoding(Charset.forName((String) hints.get(EncodeHintType
.CHARACTER_SET)));
}
}
return bitMatrixFromEncoder(encoder, contents, errorCorrectionLevel, width, height, margin);
}
示例2: encode
import com.google.zxing.pdf417.encoder.Dimensions; //导入依赖的package包/类
@Override
public BitMatrix encode(String contents,
BarcodeFormat format,
int width,
int height,
Map<EncodeHintType,?> hints) throws WriterException {
if (format != BarcodeFormat.PDF_417) {
throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
}
PDF417 encoder = new PDF417();
int margin = WHITE_SPACE;
if (hints != null) {
if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
encoder.setCompact((Boolean) hints.get(EncodeHintType.PDF417_COMPACT));
}
if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
encoder.setCompaction((Compaction) hints.get(EncodeHintType.PDF417_COMPACTION));
}
if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
encoder.setDimensions(dimensions.getMaxCols(),
dimensions.getMinCols(),
dimensions.getMaxRows(),
dimensions.getMinRows());
}
if (hints.containsKey(EncodeHintType.MARGIN)) {
margin = ((Number) hints.get(EncodeHintType.MARGIN)).intValue();
}
if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
String encoding = (String) hints.get(EncodeHintType.CHARACTER_SET);
encoder.setEncoding(Charset.forName(encoding));
}
}
return bitMatrixFromEncoder(encoder, contents, width, height, margin);
}
示例3: encode
import com.google.zxing.pdf417.encoder.Dimensions; //导入依赖的package包/类
@Override
public BitMatrix encode(String contents,
BarcodeFormat format,
int width,
int height,
Map<EncodeHintType, ?> hints) throws WriterException {
if (format != BarcodeFormat.PDF_417) {
throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
}
PDF417 encoder = new PDF417();
int margin = WHITE_SPACE;
if (hints != null) {
if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
encoder.setCompact((Boolean) hints.get(EncodeHintType.PDF417_COMPACT));
}
if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
encoder.setCompaction((Compaction) hints.get(EncodeHintType.PDF417_COMPACTION));
}
if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
encoder.setDimensions(dimensions.getMaxCols(),
dimensions.getMinCols(),
dimensions.getMaxRows(),
dimensions.getMinRows());
}
if (hints.containsKey(EncodeHintType.MARGIN)) {
margin = ((Number) hints.get(EncodeHintType.MARGIN)).intValue();
}
if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
String encoding = (String) hints.get(EncodeHintType.CHARACTER_SET);
encoder.setEncoding(Charset.forName(encoding));
}
}
return bitMatrixFromEncoder(encoder, contents, width, height, margin);
}
示例4: encode
import com.google.zxing.pdf417.encoder.Dimensions; //导入依赖的package包/类
@Override
public BitMatrix encode(String contents,
BarcodeFormat format,
int width,
int height,
Map<EncodeHintType, ?> hints) throws WriterException {
if (format != BarcodeFormat.PDF_417) {
throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
}
PDF417 encoder = new PDF417();
if (hints != null) {
if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
encoder.setCompact((Boolean) hints.get(EncodeHintType.PDF417_COMPACT));
}
if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
encoder.setCompaction((Compaction) hints.get(EncodeHintType.PDF417_COMPACTION));
}
if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
encoder.setDimensions(dimensions.getMaxCols(),
dimensions.getMinCols(),
dimensions.getMaxRows(),
dimensions.getMinRows());
}
}
return bitMatrixFromEncoder(encoder, contents, width, height);
}
示例5: encode
import com.google.zxing.pdf417.encoder.Dimensions; //导入依赖的package包/类
@Override
public BitMatrix encode(String contents,
BarcodeFormat format,
int width,
int height,
Map<EncodeHintType,?> hints) throws WriterException {
if (format != BarcodeFormat.PDF_417) {
throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
}
PDF417 encoder = new PDF417();
if (hints != null) {
if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
encoder.setCompact((Boolean) hints.get(EncodeHintType.PDF417_COMPACT));
}
if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
encoder.setCompaction((Compaction) hints.get(EncodeHintType.PDF417_COMPACTION));
}
if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
encoder.setDimensions(dimensions.getMaxCols(),
dimensions.getMinCols(),
dimensions.getMaxRows(),
dimensions.getMinRows());
}
}
return bitMatrixFromEncoder(encoder, contents, width, height);
}
示例6: encode
import com.google.zxing.pdf417.encoder.Dimensions; //导入依赖的package包/类
@Override
public BitMatrix encode(String contents,
BarcodeFormat format,
int width,
int height,
Map<EncodeHintType,?> hints) throws WriterException {
if (format != BarcodeFormat.PDF_417) {
throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
}
PDF417 encoder = new PDF417();
int margin = WHITE_SPACE;
int errorCorrectionLevel = DEFAULT_ERROR_CORRECTION_LEVEL;
if (hints != null) {
if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
encoder.setCompact(Boolean.valueOf(hints.get(EncodeHintType.PDF417_COMPACT).toString()));
}
if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
encoder.setCompaction(Compaction.valueOf(hints.get(EncodeHintType.PDF417_COMPACTION).toString()));
}
if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
encoder.setDimensions(dimensions.getMaxCols(),
dimensions.getMinCols(),
dimensions.getMaxRows(),
dimensions.getMinRows());
}
if (hints.containsKey(EncodeHintType.MARGIN)) {
margin = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
}
if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
errorCorrectionLevel = Integer.parseInt(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
}
if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
Charset encoding = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toString());
encoder.setEncoding(encoding);
}
}
return bitMatrixFromEncoder(encoder, contents, errorCorrectionLevel, width, height, margin);
}
示例7: encode
import com.google.zxing.pdf417.encoder.Dimensions; //导入依赖的package包/类
@Override
public BitMatrix encode(String contents,
BarcodeFormat format,
int width,
int height,
Map<EncodeHintType, ?> hints) throws WriterException {
if (format != BarcodeFormat.PDF_417) {
throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
}
PDF417 encoder = new PDF417();
int margin = WHITE_SPACE;
int errorCorrectionLevel = DEFAULT_ERROR_CORRECTION_LEVEL;
if (hints != null) {
if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
encoder.setCompact(Boolean.valueOf(hints.get(EncodeHintType.PDF417_COMPACT).toString()));
}
if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
encoder.setCompaction(Compaction.valueOf(hints.get(EncodeHintType.PDF417_COMPACTION).toString()));
}
if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
encoder.setDimensions(dimensions.getMaxCols(),
dimensions.getMinCols(),
dimensions.getMaxRows(),
dimensions.getMinRows());
}
if (hints.containsKey(EncodeHintType.MARGIN)) {
margin = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
}
if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
errorCorrectionLevel = Integer.parseInt(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
}
if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
Charset encoding = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toString());
encoder.setEncoding(encoding);
}
}
return bitMatrixFromEncoder(encoder, contents, errorCorrectionLevel, width, height, margin);
}
示例8: pdf417Dimensions
import com.google.zxing.pdf417.encoder.Dimensions; //导入依赖的package包/类
@Override
public Dimensions pdf417Dimensions() {
return pdf417Dimensions;
}