public abstract class OneDimensionalCodeWriter extends Object implements Writer
Encapsulates functionality and implementation that is common to one-dimensional barcodes.
| Constructor and Description |
|---|
OneDimensionalCodeWriter() |
| Modifier and Type | Method and Description |
|---|---|
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
Writerencode in interface Writercontents - The contents to encode in the barcodeformat - The barcode format to generatewidth - The preferred width in pixelsheight - The preferred height in pixelsWriterExceptionpublic 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 in interface Writercontents - 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 encoderWriterExceptionprotected 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-2013. All Rights Reserved.