info.bioinfweb.treegraph.graphics.export
Class SVGTranscodeWriter
java.lang.Object
info.bioinfweb.treegraph.graphics.export.AbstractGraphicWriter
info.bioinfweb.treegraph.graphics.export.SVGTranscodeWriter
- All Implemented Interfaces:
- GraphicWriter
- Direct Known Subclasses:
- JPEGWriter, PDFWriter, PNGWriter, SVGWriter, TIFFWriter
public class SVGTranscodeWriter
- extends AbstractGraphicWriter
- implements GraphicWriter
This class generates an image file from a tree document. Therefor is first generates an SVG file
and then transcodes it into the specified format (e.g. PNG or PDF).
- Author:
- Ben Stöver
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface info.bioinfweb.treegraph.graphics.export.GraphicWriter |
write |
transcoderClass
private Class<? extends org.apache.batik.transcoder.Transcoder> transcoderClass
SVGTranscodeWriter
public SVGTranscodeWriter(Class<? extends org.apache.batik.transcoder.Transcoder> transcoderClass)
addTranscodingHints
protected void addTranscodingHints(org.apache.batik.transcoder.Transcoder transcoder,
GraphicWriterHints writerHints)
This method can be overwritten to add more transcoding hints to the transcoder. This can e.g.
be done by copying graphic writer hints to transcoding hints.
Note that KEY_PIXEL_UNIT_TO_MILLIMETER
, KEY_WIDTH
,
KEY_HEIGHT
and KEY_BACKGROUND_COLOR
(the brackground color
for formats which do not support transparency) have already been added.
- Parameters:
transcoder
- the transcoder that transcodes from SVG to the respective image formatwriterHints
- the hints that were specified when the write
-method of this
writer was called
write
public void write(Document document,
TreePainter painter,
GraphicWriterHints hints,
OutputStream stream)
Writes the given document to the given stream in the graphic format provided by the
transcoder-class specified in the constructor.
The resolution the image is exportet with is taken from the hint-value for
KEY_PIXELS_PER_MILLIMETER
. Is this hint is not provided
TreeViewPanel.PIXELS_PER_MM_100
is unsed instead.
The width and the height of the resulting image are taken from the hint-values for
KEY_WIDTH
and KEY_HEIGHT
if both of them are specified. If this is not
the case, width and height are calculated from the resolution (see above) and the size of the
document. The width and height can be either defines in millimeters or in pixels. The unit can
be specified with the key KEY_DIMENSIONS_IN_PIXELS
. (false
is used by
default.)
The hint specified by KEY_TRANSPARENT
is used to define the transparency of the
image. (false
if the default value if this hint is not given.)
- Specified by:
write
in interface GraphicWriter
- Parameters:
document
- the document to be exportedpainter
- the painter to display the documenthints
- the graphic writer hints to specify certain writing optionsstream
- the output stream to write the graphic to- See Also:
GraphicWriter.write(info.bioinfweb.treegraph.document.Document, info.bioinfweb.treegraph.graphics.positionpaint.TreePainter, info.bioinfweb.treegraph.graphics.export.GraphicWriterHints, java.io.OutputStream)