net.sourceforge.barbecue.output
Class SVGOutput

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

public class SVGOutput
extends AbstractOutput

SVG outputter to output barcodes as SVG files. Contributed by Ryan Martell.

Author:
Ryan Martell, Ian Bourke

Field Summary
 
Fields inherited from class net.sourceforge.barbecue.output.AbstractOutput
backgroundColour, font, foregroundColour, painting, scalar
 
Constructor Summary
SVGOutput(java.io.Writer writer, java.awt.Font font, java.awt.Color fgColor, java.awt.Color bgColor, double scalar, java.lang.String units)
          Creates a new instance of SVGOutput.
 
Method Summary
 void beginDraw()
          From AbstractOutput - sets up the SVG output.
protected  org.jdom.Element createElement(java.lang.String name)
           
 int drawBar(int x, int y, int width, int height, boolean paintWithForegroundColor)
          From AbstractOutput - outputs the correct rectangle to the SVG output.
 int drawText(java.lang.String text, LabelLayout layout)
          Draw the specified text.
 void endDraw(int width, int height)
          From AbstractOutput - finished up the SVG output.
 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

SVGOutput

public SVGOutput(java.io.Writer writer,
                 java.awt.Font font,
                 java.awt.Color fgColor,
                 java.awt.Color bgColor,
                 double scalar,
                 java.lang.String units)
Creates a new instance of SVGOutput.

Parameters:
writer - The Writer to output the SVG text to
font - The font for text rendering (only if Barcode has drawText set to true)
fgColor - Foreground color
bgColor - Background color
scalar - The scalar value to convert to units. if barWidth is 1, and you want the smallest bar to be 1/128 of an inch, this should be set to 1.0/128, and units should be set to "in"
units - The units for the scalar, above. "in", "cm", "mm", "px" are acceptable values.
Method Detail

beginDraw

public void beginDraw()
From AbstractOutput - sets up the SVG output.


endDraw

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

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

createElement

protected org.jdom.Element createElement(java.lang.String name)

drawBar

public int drawBar(int x,
                   int y,
                   int width,
                   int height,
                   boolean paintWithForegroundColor)
From AbstractOutput - outputs the correct rectangle to the SVG 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

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

paintBackground

public void paintBackground(int x,
                            int y,
                            int width,
                            int height)
Description copied from interface: Output
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.