barcode4j 2.1.0

org.krysalis.barcode4j.output
Class Canvas

java.lang.Object
  extended by org.krysalis.barcode4j.output.Canvas

public class Canvas
extends java.lang.Object

This class is used by barcode rendering classes that paint a barcode using a coordinate system. The class delegates the call to a CanvasProvider and provides some convenience methods.

Version:
$Id: Canvas.java,v 1.4 2008/05/13 13:00:45 jmaerki Exp $
Author:
Jeremias Maerki

Constructor Summary
Canvas(CanvasProvider canvasImp)
          Main constructor
 
Method Summary
 void drawCenteredChar(char ch, double x1, double x2, double y1, java.lang.String fontName, double fontSize)
          Draws a centered character.
 void drawCenteredText(java.lang.String text, double x1, double x2, double y1, java.lang.String fontName, double fontSize)
          Deprecated. Use drawText(String, double, double, double, String, double, TextAlignment) instead.
 void drawJustifiedText(java.lang.String text, double x1, double x2, double y1, java.lang.String fontName, double fontSize)
          Deprecated. Use drawText(String, double, double, double, String, double, TextAlignment) instead.
 void drawRect(double x1, double y1, double x2, double y2)
          Draws a rectangle.
 void drawRectWH(double x, double y, double w, double h)
          Draws a rectangle
 void drawText(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.
 CanvasProvider getCanvasImp()
          Returns the canvas provider in use.
 int getOrientation()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Canvas

public Canvas(CanvasProvider canvasImp)
Main constructor

Parameters:
canvasImp - the canvas provider to use
Method Detail

getCanvasImp

public CanvasProvider getCanvasImp()
Returns the canvas provider in use.

Returns:
the canvas provider

establishDimensions

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

Parameters:
dim - the barcode dimensions

getOrientation

public int getOrientation()
Returns:
the orientation of the barcode (0, 90, 180, 270, -90, -180, -270)

drawRect

public void drawRect(double x1,
                     double y1,
                     double x2,
                     double y2)
Draws a rectangle.

Parameters:
x1 - x coordinate of the upper left corner
y1 - y coordinate of the upper left corner
x2 - x coordinate of the lower right corner
y2 - y coordinate of the lower right corner

drawRectWH

public void drawRectWH(double x,
                       double y,
                       double w,
                       double h)
Draws a rectangle

Parameters:
x - x coordinate of the upper left corner
y - y coordinate of the upper left corner
w - the width
h - the height

drawCenteredChar

public void drawCenteredChar(char ch,
                             double x1,
                             double x2,
                             double y1,
                             java.lang.String fontName,
                             double fontSize)
Draws a centered character.

Parameters:
ch - the character
x1 - the left boundary
x2 - the right boundary
y1 - the y coordinate
fontName - the name of the font
fontSize - the size of the font

drawJustifiedText

public void drawJustifiedText(java.lang.String text,
                              double x1,
                              double x2,
                              double y1,
                              java.lang.String fontName,
                              double fontSize)
Deprecated. Use drawText(String, double, double, double, String, double, TextAlignment) instead.

Draws justified 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

drawCenteredText

public void drawCenteredText(java.lang.String text,
                             double x1,
                             double x2,
                             double y1,
                             java.lang.String fontName,
                             double fontSize)
Deprecated. Use drawText(String, double, double, double, String, double, TextAlignment) instead.

Draws centered 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

drawText

public void drawText(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.