net.sourceforge.barbecue.output
Class GraphicsOutput

java.lang.Object
  extended bynet.sourceforge.barbecue.output.AbstractOutput
      extended bynet.sourceforge.barbecue.output.GraphicsOutput
All Implemented Interfaces:
Output

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
 
Fields inherited from class net.sourceforge.barbecue.output.AbstractOutput
backgroundColour, font, foregroundColour, painting, scalar
 
Constructor Summary
GraphicsOutput(java.awt.Graphics2D graphics, java.awt.Font font, java.awt.Color fgColor, java.awt.Color bgColor)
          Creates a Graphics2D AbstractOutput
 
Method Summary
 void beginDraw()
          From AbstractOutput - Saves current colour.
 int drawBar(int x, int y, int width, int height, boolean paintWithForegroundColor)
          From AbstractOutput - Draws a bar at the given coordinates onto the output Graphics.
 int drawText(java.lang.String text, LabelLayout labelLayout)
          Draw the specified text.
 void endDraw(int width, int height)
          From AbstractOutput - Restores colour.
 void paintBackground(int x, int y, int width, int height)
          Paint the background the background colour, based on the height and the width.
 
Methods inherited from class net.sourceforge.barbecue.output.AbstractOutput
toggleDrawingColor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicsOutput

public GraphicsOutput(java.awt.Graphics2D graphics,
                      java.awt.Font font,
                      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
fgColor - Foreground Color
bgColor - Background Color
Method Detail

beginDraw

public void beginDraw()
From AbstractOutput - Saves current colour.


endDraw

public void endDraw(int width,
                    int height)
From AbstractOutput - Restores colour.

Parameters:
width - The output width (in pixels) of the barcode
height - The output height (in pixels) of the barcode

drawBar

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

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
Returns:
the width of the bar drawn

drawText

public int drawText(java.lang.String text,
                    LabelLayout labelLayout)
             throws OutputException
Description copied from interface: Output
Draw the specified text.

Parameters:
text - text to draw
labelLayout - the text layout calculator
Returns:
the height of this text
Throws:
OutputException

paintBackground

public void paintBackground(int x,
                            int y,
                            int width,
                            int height)
Paint the background the background colour, based on the height and the width.

Parameters:
x - the x coordinate
y - the y coordinate
width - the width to be painted
height - the height to be painted


Copyright © 2003-2007 barbecue.sourceforge.net. All Rights Reserved.