net.sourceforge.barbecue.output
Class EPSOutput

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

public class EPSOutput
extends AbstractOutput

EPS outputter to output barcodes as Encapsulated Postscript files. Contributed by Tim Molteno.

Author:
Tim Molteno

Field Summary
 
Fields inherited from class net.sourceforge.barbecue.output.AbstractOutput
backgroundColour, font, foregroundColour, painting, scalar
 
Constructor Summary
EPSOutput(java.io.Writer writer)
          Creates a new instance of EPSOutput.
 
Method Summary
 void beginDraw()
          Sets up the drawing environment.
 int drawBar(int x, int y, int width, int height, boolean paintWithForegroundColor)
          From AbstractOutput - outputs the correct rectangle to the EPS output.
 double drawBarEPS(double x, double y, double width, double height, boolean paintWithForegroundColor)
          From AbstractOutput - outputs the correct rectangle to the EPS output.
 int drawText(java.lang.String text, LabelLayout layout)
          Draw the specified text.
 void endDraw(int width, int height)
          From AbstractOutput - finished up the EPS output.
 void paintBackground(int x, int y, int width, int height)
          Paint the background the background colour, based on the height and the width.
 void toggleDrawingColor()
          Disables any drawing to the Output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPSOutput

public EPSOutput(java.io.Writer writer)
Creates a new instance of EPSOutput.

Parameters:
writer - The Writer to output the EPS text to
Method Detail

beginDraw

public void beginDraw()
Description copied from interface: Output
Sets up the drawing environment. Called before drawing starts. Matched with call to endDraw() at the end. This allows for caching as needed.


endDraw

public void endDraw(int width,
                    int height)
From AbstractOutput - finished up the EPS output.

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 - outputs the correct rectangle to the EPS output.

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

drawBarEPS

public double drawBarEPS(double x,
                         double y,
                         double width,
                         double height,
                         boolean paintWithForegroundColor)
From AbstractOutput - outputs the correct rectangle to the EPS output.

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 int drawText(java.lang.String text,
                    LabelLayout layout)
             throws OutputException
Description copied from interface: Output
Draw the specified text.

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

toggleDrawingColor

public void toggleDrawingColor()
Description copied from class: AbstractOutput
Disables any drawing to the Output. Useful for sizing calculations.

Specified by:
toggleDrawingColor in interface Output
Overrides:
toggleDrawingColor in class AbstractOutput

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.