Package org.krysalis.barcode4j.output
Class Canvas
java.lang.Object
org.krysalis.barcode4j.output.Canvas
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawCenteredChar(char ch, double x1, double x2, double y1, String fontName, double fontSize) Draws a centered character.voiddrawCenteredText(String text, double x1, double x2, double y1, String fontName, double fontSize) Deprecated.voiddrawJustifiedText(String text, double x1, double x2, double y1, String fontName, double fontSize) Deprecated.voiddrawRect(double x1, double y1, double x2, double y2) Draws a rectangle.voiddrawRectWH(double x, double y, double w, double h) Draws a rectanglevoiddrawText(String text, double x1, double x2, double y1, String fontName, double fontSize, TextAlignment textAlign) Draws text.voidSets the dimensions of the barcode.Returns the canvas provider in use.int
-
Constructor Details
-
Canvas
Main constructor- Parameters:
canvasImp- the canvas provider to use
-
-
Method Details
-
getCanvasImp
Returns the canvas provider in use.- Returns:
- the canvas provider
-
establishDimensions
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 cornery1- y coordinate of the upper left cornerx2- x coordinate of the lower right cornery2- 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 cornery- y coordinate of the upper left cornerw- the widthh- the height
-
drawCenteredChar
public void drawCenteredChar(char ch, double x1, double x2, double y1, String fontName, double fontSize) Draws a centered character.- Parameters:
ch- the characterx1- the left boundaryx2- the right boundaryy1- the y coordinatefontName- the name of the fontfontSize- the size of the font
-
drawJustifiedText
public void drawJustifiedText(String text, double x1, double x2, double y1, String fontName, double fontSize) Deprecated.Draws justified 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 font
-
drawCenteredText
public void drawCenteredText(String text, double x1, double x2, double y1, String fontName, double fontSize) Deprecated.Draws centered 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 font
-
drawText
public void drawText(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
-
drawText(String, double, double, double, String, double, TextAlignment)instead.