public abstract class OneDimensionalCodeWriter extends Object implements Writer
Encapsulates functionality and implementation that is common to one-dimensional barcodes.
构造器和说明 |
---|
OneDimensionalCodeWriter() |
限定符和类型 | 方法和说明 |
---|---|
protected static int |
appendPattern(boolean[] target,
int pos,
int[] pattern,
boolean startColor)
Appends the given pattern to the target array starting at pos.
|
abstract boolean[] |
encode(String contents)
Encode the contents to boolean array expression of one-dimensional barcode.
|
BitMatrix |
encode(String contents,
BarcodeFormat format,
int width,
int height)
Encode a barcode using the default settings.
|
BitMatrix |
encode(String contents,
BarcodeFormat format,
int width,
int height,
Map<EncodeHintType,?> hints)
Encode the contents following specified format.
|
int |
getDefaultMargin() |
public final BitMatrix encode(String contents, BarcodeFormat format, int width, int height) throws WriterException
Writer
encode
在接口中 Writer
contents
- The contents to encode in the barcodeformat
- The barcode format to generatewidth
- The preferred width in pixelsheight
- The preferred height in pixelsWriterException
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException
width
and height
are required size. This method may return bigger size
BitMatrix
when specified size is too small. The user can set both width
and
height
to zero to get minimum size barcode. If negative value is set to width
or height
, IllegalArgumentException
is thrown.encode
在接口中 Writer
contents
- The contents to encode in the barcodeformat
- The barcode format to generatewidth
- The preferred width in pixelsheight
- The preferred height in pixelshints
- Additional parameters to supply to the encoderWriterException
protected static int appendPattern(boolean[] target, int pos, int[] pattern, boolean startColor)
startColor
- starting color - false for white, true for blackpublic int getDefaultMargin()
public abstract boolean[] encode(String contents)
boolean[]
of horizontal pixels (false = white, true = black)Copyright © 2007–2014. All rights reserved.