Package hec.swing.svg

Class SVGUtilities

java.lang.Object
hec.swing.svg.SVGUtilities

public class SVGUtilities extends Object
  • Method Details

    • renderToSVG

      public static SVGData renderToSVG(JComponent jcomponent) throws SVGException
      Draw the JComponent into an SVG. This will call print() on the component.
      Parameters:
      jcomponent - The JComponent to draw
      Returns:
      A string containing the component
      Throws:
      SVGException
    • renderToSVG

      public static SVGData renderToSVG(Dimension size, Consumer<Graphics2D> customPrintFunction) throws SVGException
      Render a component to a String in SVG Format.
      Parameters:
      customPrintFunction - A function that renders into the provided Graphics2D context. Useful when a standard print() isn't quite right.
      Returns:
      SVGData containing the image rendered onto the graphics context.
      Throws:
      SVGException