net.sourceforge.barbecue.output
Class SizingOutput

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

public class SizingOutput
extends AbstractOutput

The SizingOutput class is used to calculate the size of a barcode.

This class will not generate any output.


Field Summary
 
Fields inherited from class net.sourceforge.barbecue.output.AbstractOutput
backgroundColour, font, foregroundColour, painting, scalar
 
Constructor Summary
SizingOutput(java.awt.Font font, java.awt.Color fgColor, java.awt.Color bgColor)
           
SizingOutput(java.awt.Font font, java.awt.FontMetrics fm, java.awt.Color fgColor, java.awt.Color bgColor)
           
 
Method Summary
 void beginDraw()
          Sets up the drawing environment.
 int drawBar(int x, int y, int width, int height, boolean paintWithForegroundColor)
          "Draws" a bar at the given coordinates.
 int drawText(java.lang.String text, LabelLayout labelLayout)
          Draw the specified text.
 void endDraw(int width, int height)
          Balanced with startDraw() above, used for caching, output of epilogues (for SVG), etc.
 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

SizingOutput

public SizingOutput(java.awt.Font font,
                    java.awt.Color fgColor,
                    java.awt.Color bgColor)

SizingOutput

public SizingOutput(java.awt.Font font,
                    java.awt.FontMetrics fm,
                    java.awt.Color fgColor,
                    java.awt.Color bgColor)
Method Detail

drawBar

public int drawBar(int x,
                   int y,
                   int width,
                   int height,
                   boolean paintWithForegroundColor)
"Draws" a bar at the given coordinates.

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

beginDraw

public void beginDraw()
Sets up the drawing environment. Called before drawBar(). Matched with call to endDraw() at the end. This allows for caching as needed.


endDraw

public void endDraw(int width,
                    int height)
Balanced with startDraw() above, used for caching, output of epilogues (for SVG), etc.

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

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.