Class BitmapCanvasProvider
java.lang.Object
org.krysalis.barcode4j.output.AbstractCanvasProvider
org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider
- All Implemented Interfaces:
CanvasProvider
CanvasProvider implementation for generating bitmaps. This class wraps
Java2DCanvasProvider to do the actual rendering.
- Version:
- $Id: BitmapCanvasProvider.java,v 1.4 2008-05-13 13:00:46 jmaerki Exp $
- Author:
- Jeremias Maerki
-
Field Summary
Fields inherited from class org.krysalis.barcode4j.output.AbstractCanvasProvider
bardim -
Constructor Summary
ConstructorsConstructorDescriptionBitmapCanvasProvider(int resolution, int imageType, boolean antiAlias, int orientation) Creates a new BitmapCanvasProvider.BitmapCanvasProvider(OutputStream out, String mime, int resolution, int imageType, boolean antiAlias, int orientation) Creates a new BitmapCanvasProvider. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeviceFillRect(double x, double y, double w, double h) Paints a filled rectangle.voiddeviceText(String text, double x1, double x2, double y1, String fontName, double fontSize, TextAlignment textAlign) Draws text.voidSets the dimensions of the barcode.voidfinish()Call this method to finish any pending operations after the BarcodeGenerator has finished its work.Returns the buffered image that is used to paint the barcode on.Methods inherited from class org.krysalis.barcode4j.output.AbstractCanvasProvider
deviceCenteredText, deviceJustifiedText, getDimensions, getOrientation
-
Constructor Details
-
BitmapCanvasProvider
public BitmapCanvasProvider(OutputStream out, String mime, int resolution, int imageType, boolean antiAlias, int orientation) Creates a new BitmapCanvasProvider.- Parameters:
out- OutputStream to write tomime- MIME type of the desired output format (ex. "image/png")resolution- the desired image resolution (dots per inch)imageType- the desired image type (Values: BufferedImage.TYPE_*)antiAlias- true if anti-aliasing should be enabled
-
BitmapCanvasProvider
public BitmapCanvasProvider(int resolution, int imageType, boolean antiAlias, int orientation) Creates a new BitmapCanvasProvider.- Parameters:
resolution- the desired image resolution (dots per inch)imageType- the desired image type (Values: BufferedImage.TYPE_*)antiAlias- true if anti-aliasing should be enabled
-
-
Method Details
-
finish
Call this method to finish any pending operations after the BarcodeGenerator has finished its work.- Throws:
IOException- in case of an I/O problem
-
getBufferedImage
Returns the buffered image that is used to paint the barcode on.- Returns:
- the image.
-
establishDimensions
Sets the dimensions of the barcode.- Specified by:
establishDimensionsin interfaceCanvasProvider- Overrides:
establishDimensionsin classAbstractCanvasProvider- Parameters:
dim- the dimensions of the barcode
-
deviceFillRect
public void deviceFillRect(double x, double y, double w, double h) Paints a filled rectangle.- Parameters:
x- x coordinate of the upper left cornery- y coordinate of the upper left cornerw- the widthh- the height
-
deviceText
public void deviceText(String text, double x1, double x2, double y1, String fontName, double fontSize, TextAlignment textAlign) Draws text.- Parameters:
text- the text to drawx1- the left boundaryx2- the right boundaryy1- the y coordinatefontName- the name of the fontfontSize- the size of the fonttextAlign- the text alignment
-