use of org.apache.batik.bridge.DynamicGVTBuilder in project scout.rt by eclipse.
the class SVGUtility method readSVGDocumentForGraphicalModification.
/**
* Parses a SVG document read by the given input stream and attaches a GVT tree. An attached GVT tree is required for
* performing CSS, text size and and bounding box operations on the SVG document.
* <p/>
* The resulting bridge context holds a reference to the SVG document {@link BridgeContext#getDocument()}
* <p/>
* <h1>Important:</h1> Callers are required to invoke {@link BridgeContext#dispose()} on the returned bridge context
* as soon as the bridge or the document it references is not required anymore.
* <p/>
* If the documents needs not be manipulated, use {@link #readSVGDocument(InputStream)} instead.
*
* @param in
* input stream the SVG document is read from.
* @return Returns a bridge context that holds references to the SVG document as well as to the GVT tree wrapping
* objects.
*/
public static BridgeContext readSVGDocumentForGraphicalModification(InputStream in) {
SVGDocument doc = readSVGDocument(in);
// add a gvt tree for text and alignment calculations
BridgeContext bc = new BridgeContext(new UserAgentAdapter());
bc.setDynamic(true);
GVTBuilder builder = new DynamicGVTBuilder();
builder.build(bc, doc);
return bc;
}
Aggregations