public class DefaultCanvasLogicHandler extends Object implements ClassicBarcodeLogicHandler
| Modifier and Type | Field and Description |
|---|---|
protected AbstractBarcodeBean |
bcBean
the barcode bean
|
protected Canvas |
canvas
the canvas to paint on
|
protected BarcodeDimension |
dimensions
the barcode dimensions
|
| Constructor and Description |
|---|
DefaultCanvasLogicHandler(AbstractBarcodeBean bcBean,
Canvas canvas)
Main constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBar(boolean black,
int width)
This method indicates a new bar to be painted.
|
void |
endBarcode()
This is always the last method called.
|
void |
endBarGroup()
This method indicates the end of a previously started bar group.
|
protected double |
getStartX()
Returns the start X position of the bars.
|
protected double |
getStartY()
Returns the start Y position of the bars.
|
protected double |
getTextBaselinePosition()
Returns the vertical text baseline position.
|
void |
startBarcode(String msg,
String formattedMsg)
This is always the first method called.
|
void |
startBarGroup(BarGroup type,
String submsg)
This method is called when a new group of bars is about to start.
|
protected AbstractBarcodeBean bcBean
protected Canvas canvas
protected BarcodeDimension dimensions
public DefaultCanvasLogicHandler(AbstractBarcodeBean bcBean, Canvas canvas)
bcBean - the barcode implementation classcanvas - the canvas to paint toprotected double getStartX()
protected double getStartY()
public void startBarcode(String msg, String formattedMsg)
startBarcode in interface BarcodeLogicHandlermsg - full message to be encodedformattedMsg - message as it is to be presented in the
human-readable partpublic void startBarGroup(BarGroup type, String submsg)
startBarGroup in interface ClassicBarcodeLogicHandlertype - a constant indicating the type of group. The meaning of the
integer values is implementation-dependant.submsg - In case of parts of the message to be encoded this
parameter holds the character or characters being encoded.public void addBar(boolean black,
int width)
addBar in interface ClassicBarcodeLogicHandlerblack - True if the bar is to be painted black, False if
white/transparentwidth - logical weight of the bar. Concrete implementations are
free to define this to be height or width. For example, 1 may be interpreted
as "narrow bar", 2 as "wide bar" for certain barcodes. While other barcodes
might define 1 to be "short bar", 2 as "tall bar".
Also, this should not be confused with the effective painting width, or the
actual physical size of the bar.public void endBarGroup()
endBarGroup in interface ClassicBarcodeLogicHandlerpublic void endBarcode()
endBarcode in interface BarcodeLogicHandlerprotected double getTextBaselinePosition()
Copyright © 2003–2023. All rights reserved.