net.sourceforge.barbecue.output
Class GraphicsOutput

java.lang.Object
  extended bynet.sourceforge.barbecue.output.AbstractOutput
      extended bynet.sourceforge.barbecue.output.GraphicsOutput

public class GraphicsOutput
extends AbstractOutput

Graphics based outputter to draw barcodes to Graphics objects for printing and display.

Author:
Ryan Martell, Ian Bourke

Field Summary
static int BARS_TEXT_VGAP
          Pixel gap between the barcode bars and the top of the data text underneath
 
Fields inherited from class net.sourceforge.barbecue.output.AbstractOutput
backgroundColour, barHeight, font, foregroundColour, painting, scalar
 
Constructor Summary
GraphicsOutput(java.awt.Graphics2D graphics, java.awt.Font font, double barWidth, double barHeight, boolean paint, java.awt.Color fgColor, java.awt.Color bgColor)
          Creates a Graphics2D AbstractOutput
 
Method Summary
 void beginDraw(double width, double height)
          From AbstractOutput - Does nothing.
 void drawBar(int x, int y, int width, int height, boolean paintWithForegroundColor)
          From AbstractOutput - Draws a bar at the given coordinates onto the output Graphics.
 double drawText(java.lang.String text, double x, double y, double width)
          From AbstractOutput - Draw the specified text to the output graphics.
 void endDraw()
          From AbstractOutput - Does nothing.
 
Methods inherited from class net.sourceforge.barbecue.output.AbstractOutput
getBackgroundColour, getBarHeight, getBarWidth, getForegroundColour, setupForBlankDrawing, teardownFromBlankDrawing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BARS_TEXT_VGAP

public static final int BARS_TEXT_VGAP
Pixel gap between the barcode bars and the top of the data text underneath

See Also:
Constant Field Values
Constructor Detail

GraphicsOutput

public GraphicsOutput(java.awt.Graphics2D graphics,
                      java.awt.Font font,
                      double barWidth,
                      double barHeight,
                      boolean paint,
                      java.awt.Color fgColor,
                      java.awt.Color bgColor)
Creates a Graphics2D AbstractOutput

Parameters:
graphics - The graphics to output to
font - The font for text rendering
barWidth - The width of the smallest bar
barHeight - The height of the barcode
paint - If true, we are drawing, if false we are calculating
fgColor - Foreground Color
bgColor - Background Color
Method Detail

beginDraw

public void beginDraw(double width,
                      double height)
From AbstractOutput - Does nothing.

Specified by:
beginDraw in class AbstractOutput
Parameters:
width - The output width (in pixels) of the barcode
height - The output height (in pixels) of the barcode.

endDraw

public void endDraw()
From AbstractOutput - Does nothing.

Specified by:
endDraw in class AbstractOutput

drawBar

public void drawBar(int x,
                    int y,
                    int width,
                    int height,
                    boolean paintWithForegroundColor)
From AbstractOutput - Draws a bar at the given coordinates onto the output Graphics.

Specified by:
drawBar in class AbstractOutput
Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height
paintWithForegroundColor - if true, use the foreground color, otherwise use the background color

drawText

public double drawText(java.lang.String text,
                       double x,
                       double y,
                       double width)
From AbstractOutput - Draw the specified text to the output graphics.

Specified by:
drawText in class AbstractOutput
Parameters:
text - The text to draw
x - The x position
y - The y position
width - The width of barcode (total)
Returns:
The height of this text