org.apache.batik.transcoder

Class ToSVGAbstractTranscoder

public abstract class ToSVGAbstractTranscoder extends AbstractTranscoder implements SVGConstants

This class allows to simplify the creation of a transcoder which transcodes to SVG content.

To use this class, you just have to implement the transcode method of the AbstractTranscoder class :

Several transcoding hints are defined for this abstract transcoder, but no default implementation is provided. Subclasses must implement which keys are relevant to them :

     transcoder.addTranscodingHint(ToSVGAbstractTranscoder.KEY_INPUT_WIDTH, new Integer(input_width));
  
  • KEY_WIDTH, KEY_HEIGHT : this Float values allows to force the width and height of the output:
         transcoder.addTranscodingHint(ToSVGAbstractTranscoder.KEY_WIDTH, new Float(width));
      
  • Field Summary
    static intERROR_INCOMPATIBLE_INPUT_TYPE
    static intERROR_INCOMPATIBLE_OUTPUT_TYPE
    static intERROR_NULL_INPUT
    static TranscodingHints.KeyKEY_ESCAPED
    static TranscodingHints.KeyKEY_HEIGHT
    static TranscodingHints.KeyKEY_INPUT_HEIGHT
    static TranscodingHints.KeyKEY_INPUT_WIDTH
    static TranscodingHints.KeyKEY_WIDTH
    static TranscodingHints.KeyKEY_XOFFSET
    static TranscodingHints.KeyKEY_YOFFSET
    static floatPIXEL_PER_INCH
    static floatPIXEL_TO_MILLIMETERS
    protected SVGGraphics2DsvgGenerator
    static intTRANSCODER_ERROR_BASE
    Method Summary
    protected DocumentcreateDocument(TranscoderOutput output)
    Create an empty Document from a TranscoderOutput.
    SVGGraphics2DgetGraphics2D()
    Get the {@link org.apache.batik.svggen.SVGGraphics2D} associated with this transcoder.
    protected voidwriteSVGToOutput(SVGGraphics2D svgGenerator, Element svgRoot, TranscoderOutput output)
    Writes the SVG content held by the svgGenerator to the TranscoderOutput.

    Field Detail

    ERROR_INCOMPATIBLE_INPUT_TYPE

    public static final int ERROR_INCOMPATIBLE_INPUT_TYPE

    ERROR_INCOMPATIBLE_OUTPUT_TYPE

    public static final int ERROR_INCOMPATIBLE_OUTPUT_TYPE

    ERROR_NULL_INPUT

    public static final int ERROR_NULL_INPUT

    KEY_ESCAPED

    public static final TranscodingHints.Key KEY_ESCAPED

    KEY_HEIGHT

    public static final TranscodingHints.Key KEY_HEIGHT

    KEY_INPUT_HEIGHT

    public static final TranscodingHints.Key KEY_INPUT_HEIGHT

    KEY_INPUT_WIDTH

    public static final TranscodingHints.Key KEY_INPUT_WIDTH

    KEY_WIDTH

    public static final TranscodingHints.Key KEY_WIDTH

    KEY_XOFFSET

    public static final TranscodingHints.Key KEY_XOFFSET

    KEY_YOFFSET

    public static final TranscodingHints.Key KEY_YOFFSET

    PIXEL_PER_INCH

    public static float PIXEL_PER_INCH

    PIXEL_TO_MILLIMETERS

    public static float PIXEL_TO_MILLIMETERS

    svgGenerator

    protected SVGGraphics2D svgGenerator

    TRANSCODER_ERROR_BASE

    public static final int TRANSCODER_ERROR_BASE

    Method Detail

    createDocument

    protected Document createDocument(TranscoderOutput output)
    Create an empty Document from a TranscoderOutput.

    getGraphics2D

    public SVGGraphics2D getGraphics2D()
    Get the {@link org.apache.batik.svggen.SVGGraphics2D} associated with this transcoder.

    writeSVGToOutput

    protected void writeSVGToOutput(SVGGraphics2D svgGenerator, Element svgRoot, TranscoderOutput output)
    Writes the SVG content held by the svgGenerator to the TranscoderOutput. This method does nothing if the output already contains a Document.
    Copyright B) 2007 Apache Software Foundation. All Rights Reserved.