barcode4j 2.1.0

org.krysalis.barcode4j.output.bitmap
Class BitmapCanvasProvider

java.lang.Object
  extended by org.krysalis.barcode4j.output.AbstractCanvasProvider
      extended by org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider
All Implemented Interfaces:
CanvasProvider

public class BitmapCanvasProvider
extends AbstractCanvasProvider

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
BitmapCanvasProvider(int resolution, int imageType, boolean antiAlias, int orientation)
          Creates a new BitmapCanvasProvider.
BitmapCanvasProvider(java.io.OutputStream out, java.lang.String mime, int resolution, int imageType, boolean antiAlias, int orientation)
          Creates a new BitmapCanvasProvider.
 
Method Summary
 void deviceFillRect(double x, double y, double w, double h)
          Paints a filled rectangle.
 void deviceText(java.lang.String text, double x1, double x2, double y1, java.lang.String fontName, double fontSize, TextAlignment textAlign)
          Draws text.
 void establishDimensions(BarcodeDimension dim)
          Sets the dimensions of the barcode.
 void finish()
          Call this method to finish any pending operations after the BarcodeGenerator has finished its work.
 java.awt.image.BufferedImage getBufferedImage()
          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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitmapCanvasProvider

public BitmapCanvasProvider(java.io.OutputStream out,
                            java.lang.String mime,
                            int resolution,
                            int imageType,
                            boolean antiAlias,
                            int orientation)
Creates a new BitmapCanvasProvider.

Parameters:
out - OutputStream to write to
mime - 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 Detail

finish

public void finish()
            throws java.io.IOException
Call this method to finish any pending operations after the BarcodeGenerator has finished its work.

Throws:
java.io.IOException - in case of an I/O problem

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()
Returns the buffered image that is used to paint the barcode on.

Returns:
the image.

establishDimensions

public void establishDimensions(BarcodeDimension dim)
Sets the dimensions of the barcode.

Specified by:
establishDimensions in interface CanvasProvider
Overrides:
establishDimensions in class AbstractCanvasProvider
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 corner
y - y coordinate of the upper left corner
w - the width
h - the height

deviceText

public void deviceText(java.lang.String text,
                       double x1,
                       double x2,
                       double y1,
                       java.lang.String fontName,
                       double fontSize,
                       TextAlignment textAlign)
Draws text.

Parameters:
text - the text to draw
x1 - the left boundary
x2 - the right boundary
y1 - the y coordinate
fontName - the name of the font
fontSize - the size of the font
textAlign - the text alignment

barcode4j 2.1.0

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