org.apache.batik.transcoder
public abstract class ToSVGAbstractTranscoder extends AbstractTranscoder implements SVGConstants
To use this class, you just have to implement the transcode method of the AbstractTranscoder class :
Document doc = this.createDocument(output);
svgGenerator = new SVGGraphics2D(doc);
Element svgRoot = svgGenerator.getRoot();
writeSVGToOutput(svgGenerator, svgRoot, output);
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));
transcoder.addTranscodingHint(ToSVGAbstractTranscoder.KEY_WIDTH, new Float(width));
| Field Summary | |
|---|---|
| static int | ERROR_INCOMPATIBLE_INPUT_TYPE |
| static int | ERROR_INCOMPATIBLE_OUTPUT_TYPE |
| static int | ERROR_NULL_INPUT |
| static TranscodingHints.Key | KEY_ESCAPED |
| static TranscodingHints.Key | KEY_HEIGHT |
| static TranscodingHints.Key | KEY_INPUT_HEIGHT |
| static TranscodingHints.Key | KEY_INPUT_WIDTH |
| static TranscodingHints.Key | KEY_WIDTH |
| static TranscodingHints.Key | KEY_XOFFSET |
| static TranscodingHints.Key | KEY_YOFFSET |
| static float | PIXEL_PER_INCH |
| static float | PIXEL_TO_MILLIMETERS |
| protected SVGGraphics2D | svgGenerator |
| static int | TRANSCODER_ERROR_BASE |
| Method Summary | |
|---|---|
| protected Document | createDocument(TranscoderOutput output) Create an empty Document from a TranscoderOutput.
|
| SVGGraphics2D | getGraphics2D() Get the SVGGraphics2D associated
with this transcoder. |
| protected void | writeSVGToOutput(SVGGraphics2D svgGenerator, Element svgRoot, TranscoderOutput output) Writes the SVG content held by the svgGenerator to the
TranscoderOutput. |