Class DataMatrixBean
java.lang.Object
org.krysalis.barcode4j.impl.AbstractBarcodeBean
org.krysalis.barcode4j.impl.datamatrix.DataMatrixBean
- All Implemented Interfaces:
BarcodeGenerator
This class is an implementation of DataMatrix (ISO 16022:2000(E)).
- Version:
- $Id: DataMatrixBean.java,v 1.8 2011-05-04 08:29:03 jmaerki Exp $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final doubleThe default module width (dot size) for DataMatrix.Fields inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, fontName, fontSize, height, moduleWidth, msgPos, pattern, quietZone, quietZoneVertical -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalcDimensions(String msg) Calculates the dimension of a barcode with the given message.voidgenerateBarcode(CanvasProvider canvas, String msg) Generates a barcode using the given Canvas to render the barcode to its output format.doubleReturns the height of the bars.doublegetBarWidth(int width) Returns the effective width of a bar with a given logical width.Returns the maximum symbol size that is to be produced.Returns the minimum symbol size that is to be produced.getShape()Gets the requested shape for the generated barcodes.doubleReturns the vertical quiet zone.voidsetMaxSize(Dimension maxSize) Sets the maximum symbol size that is to be produced.voidsetMinSize(Dimension minSize) Sets the minimum symbol size that is to be produced.voidsetShape(SymbolShapeHint shape) Sets the requested shape for the generated barcodes.Methods inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, getFontName, getFontSize, getHeight, getHumanReadableHeight, getModuleWidth, getMsgPosition, getPattern, getQuietZone, hasFontDescender, hasQuietZone, setBarHeight, setFontName, setFontSize, setHeight, setModuleWidth, setMsgPosition, setPattern, setQuietZone, setVerticalQuietZone
-
Field Details
-
DEFAULT_MODULE_WIDTH
protected static final double DEFAULT_MODULE_WIDTHThe default module width (dot size) for DataMatrix.
-
-
Constructor Details
-
DataMatrixBean
public DataMatrixBean()Create a new instance.
-
-
Method Details
-
getShape
Gets the requested shape for the generated barcodes.- Returns:
- the requested shape (one of SymbolShapeHint.*).
-
setShape
Sets the requested shape for the generated barcodes.- Parameters:
shape- requested shape. May beSymbolShapeHint.FORCE_NONE,SymbolShapeHint.FORCE_SQUAREorSymbolShapeHint.FORCE_RECTANGLE.
-
getMinSize
Returns the minimum symbol size that is to be produced. If the method returns null, there's no constraint on the symbol size.- Returns:
- the minimum symbol size (in pixels), or null if there's no size constraint
-
setMinSize
Sets the minimum symbol size that is to be produced.- Parameters:
minSize- the minimum size (in pixels), or null for no constraint
-
getMaxSize
Returns the maximum symbol size that is to be produced. If the method returns null, there's no constraint on the symbol size.- Returns:
- the maximum symbol size (in pixels), or null if there's no size constraint
-
setMaxSize
Sets the maximum symbol size that is to be produced.- Parameters:
maxSize- the maximum size (in pixels), or null for no constraint
-
getBarHeight
public double getBarHeight()Returns the height of the bars.- Overrides:
getBarHeightin classAbstractBarcodeBean- Returns:
- the height of the bars (in mm)
-
getBarWidth
public double getBarWidth(int width) Returns the effective width of a bar with a given logical width.- Specified by:
getBarWidthin classAbstractBarcodeBean- Parameters:
width- the logical width (1=narrow, 2=wide)- Returns:
- the effective width of a bar (in mm)
-
getVerticalQuietZone
public double getVerticalQuietZone()Returns the vertical quiet zone. If no vertical quiet zone is set explicitely, the value ifAbstractBarcodeBean.getQuietZone()is returned.- Overrides:
getVerticalQuietZonein classAbstractBarcodeBean- Returns:
- the height of the vertical quiet zone (in mm)
-
generateBarcode
Generates a barcode using the given Canvas to render the barcode to its output format.- Specified by:
generateBarcodein interfaceBarcodeGenerator- Specified by:
generateBarcodein classAbstractBarcodeBean- Parameters:
canvas- CanvasProvider that the barcode is to be rendered on.msg- message to encode
-
calcDimensions
Calculates the dimension of a barcode with the given message. The dimensions are dependant on the configuration of the barcode generator.- Specified by:
calcDimensionsin interfaceBarcodeGenerator- Overrides:
calcDimensionsin classAbstractBarcodeBean- Parameters:
msg- message to use for calculation.- Returns:
- BarcodeDimension a BarcodeDimension object containing the barcode's dimensions
-