Search in sources :

Example 1 with GraphicsToGraphics2DAdaptor

use of com.archimatetool.export.svg.graphiti.GraphicsToGraphics2DAdaptor in project archi by archimatetool.

the class AbstractExportProvider method initialiseGraphics.

protected void initialiseGraphics() {
    // Ensure user fonts are loaded into AWT for Windows
    loadUserFontsIntoAWT();
    // Create a DOM Document
    Document document = createDocument();
    // Create a context for customisation
    // Don't embed fonts
    SVGGeneratorContext ctx = createContext(document, false);
    // Create a Batik SVGGraphics2D instance
    // Text is drawn as shapes
    svgGraphics2D = new SVGGraphics2D(ctx, true);
    // Create a Graphiti wrapper adapter
    GraphicsToGraphics2DAdaptor graphicsAdaptor = createGraphicsToGraphics2DAdaptor(svgGraphics2D, viewPortBounds);
    // Paint the figure onto the graphics instance
    figure.paint(graphicsAdaptor);
    // Dispose of this
    graphicsAdaptor.dispose();
}
Also used : GraphicsToGraphics2DAdaptor(com.archimatetool.export.svg.graphiti.GraphicsToGraphics2DAdaptor) SVGGraphics2D(org.apache.batik.svggen.SVGGraphics2D) Document(org.w3c.dom.Document) SVGGeneratorContext(org.apache.batik.svggen.SVGGeneratorContext)

Aggregations

GraphicsToGraphics2DAdaptor (com.archimatetool.export.svg.graphiti.GraphicsToGraphics2DAdaptor)1 SVGGeneratorContext (org.apache.batik.svggen.SVGGeneratorContext)1 SVGGraphics2D (org.apache.batik.svggen.SVGGraphics2D)1 Document (org.w3c.dom.Document)1