barcode4j 2.1.0

org.krysalis.barcode4j.impl.qr
Class QRCodeBean

java.lang.Object
  extended by org.krysalis.barcode4j.impl.AbstractBarcodeBean
      extended by org.krysalis.barcode4j.impl.qr.QRCodeBean
All Implemented Interfaces:
BarcodeGenerator

public class QRCodeBean
extends AbstractBarcodeBean

This class is an implementation of QR Code (ISO 18004:2006(E)).

Version:
$Id: QRCodeBean.java,v 1.3 2012/02/08 12:59:41 jmaerki Exp $

Field Summary
protected static double DEFAULT_MODULE_WIDTH
          The 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
QRCodeBean()
          Create a new instance.
 
Method Summary
 BarcodeDimension calcDimensions(java.lang.String msg)
          Calculates the dimension of a barcode with the given message. The dimensions are dependant on the configuration of the barcode generator.
 void generateBarcode(CanvasProvider canvas, java.lang.String msg)
          Generates a barcode using the given Canvas to render the barcode to its output format.
 double getBarHeight()
          Returns the height of the bars.
 double getBarWidth(int width)
          Returns the effective width of a bar with a given logical width.
 java.lang.String getEncoding()
          Returns the message encoding.
 char getErrorCorrectionLevel()
          Returns the selected error correction level.
 java.awt.Dimension getMaxSize()
          Returns the maximum symbol size that is to be produced.
 java.awt.Dimension getMinSize()
          Returns the minimum symbol size that is to be produced.
 double getVerticalQuietZone()
          Returns the vertical quiet zone.
 void setEncoding(java.lang.String encoding)
          Sets the message encoding.
 void setErrorCorrectionLevel(char level)
          Sets the error correction level.
 void setMaxSize(java.awt.Dimension maxSize)
          Sets the maximum symbol size that is to be produced.
 void setMinSize(java.awt.Dimension minSize)
          Sets the minimum symbol size that is to be produced.
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MODULE_WIDTH

protected static final double DEFAULT_MODULE_WIDTH
The default module width (dot size) for DataMatrix.

Constructor Detail

QRCodeBean

public QRCodeBean()
Create a new instance.

Method Detail

setErrorCorrectionLevel

public void setErrorCorrectionLevel(char level)
Sets the error correction level.

Parameters:
level - the error correction level (one of L, M, Q and H)

getErrorCorrectionLevel

public char getErrorCorrectionLevel()
Returns the selected error correction level.

Returns:
the error correction level (one of L, M, Q and H)

setEncoding

public void setEncoding(java.lang.String encoding)
Sets the message encoding. The value must conform to one of Java's encodings and have a mapping in the ECI registry.

Parameters:
encoding - the message encoding

getEncoding

public java.lang.String getEncoding()
Returns the message encoding.

Returns:
the message encoding (default is "ISO-8859-1")

setMinSize

public void setMinSize(java.awt.Dimension minSize)
Sets the minimum symbol size that is to be produced.

Parameters:
minSize - the minimum size (in pixels), or null for no constraint

getMinSize

public java.awt.Dimension 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

setMaxSize

public void setMaxSize(java.awt.Dimension maxSize)
Sets the maximum symbol size that is to be produced.

Parameters:
maxSize - the maximum size (in pixels), or null for no constraint

getMaxSize

public java.awt.Dimension 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

generateBarcode

public void generateBarcode(CanvasProvider canvas,
                            java.lang.String msg)
Generates a barcode using the given Canvas to render the barcode to its output format.

Specified by:
generateBarcode in interface BarcodeGenerator
Specified by:
generateBarcode in class AbstractBarcodeBean
Parameters:
canvas - CanvasProvider that the barcode is to be rendered on.
msg - message to encode

calcDimensions

public BarcodeDimension calcDimensions(java.lang.String msg)
Calculates the dimension of a barcode with the given message. The dimensions are dependant on the configuration of the barcode generator.

Specified by:
calcDimensions in interface BarcodeGenerator
Overrides:
calcDimensions in class AbstractBarcodeBean
Parameters:
msg - message to use for calculation.
Returns:
BarcodeDimension a BarcodeDimension object containing the barcode's dimensions

getVerticalQuietZone

public double getVerticalQuietZone()
Returns the vertical quiet zone. If no vertical quiet zone is set explicitely, the value if AbstractBarcodeBean.getQuietZone() is returned.

Overrides:
getVerticalQuietZone in class AbstractBarcodeBean
Returns:
the height of the vertical quiet zone (in mm)

getBarWidth

public double getBarWidth(int width)
Returns the effective width of a bar with a given logical width.

Specified by:
getBarWidth in class AbstractBarcodeBean
Parameters:
width - the logical width (1=narrow, 2=wide)
Returns:
the effective width of a bar (in mm)

getBarHeight

public double getBarHeight()
Returns the height of the bars.

Overrides:
getBarHeight in class AbstractBarcodeBean
Returns:
the height of the bars (in mm)

barcode4j 2.1.0

Copyright © 2000-2010 Jeremias Maerki. All rights reserved.