Class FlatSVGUtils


  • public class FlatSVGUtils
    extends java.lang.Object
    Utility methods for SVG.
    • Constructor Summary

      Constructors 
      Constructor Description
      FlatSVGUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.awt.Image> createWindowIconImages​(java.lang.String svgName)
      Creates from the given SVG a list of icon images with different sizes that can be used for windows headers.
      static java.awt.image.BufferedImage svg2image​(com.kitfox.svg.SVGDiagram diagram, int width, int height)
      Creates a buffered image and renders the given SVGDiagram into it.
      static java.awt.image.BufferedImage svg2image​(java.lang.String svgName, float scaleFactor)
      Creates a buffered image and renders the given SVG into it.
      static java.awt.image.BufferedImage svg2image​(java.lang.String svgName, int width, int height)
      Creates a buffered image and renders the given SVG into it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FlatSVGUtils

        public FlatSVGUtils()
    • Method Detail

      • createWindowIconImages

        public static java.util.List<java.awt.Image> createWindowIconImages​(java.lang.String svgName)
        Creates from the given SVG a list of icon images with different sizes that can be used for windows headers. The SVG should have a size of 16x16, otherwise it is scaled.
        Parameters:
        svgName - the name of the SVG resource (a '/'-separated path)
        Returns:
        list of icon images with different sizes (16x16, 24x24, 32x32, 48x48 and 64x64)
        Throws:
        java.lang.RuntimeException - if failed to load or render SVG file
        See Also:
        Window.setIconImages(List)
      • svg2image

        public static java.awt.image.BufferedImage svg2image​(java.lang.String svgName,
                                                             int width,
                                                             int height)
        Creates a buffered image and renders the given SVG into it.
        Parameters:
        svgName - the name of the SVG resource (a '/'-separated path)
        width - the width of the image
        height - the height of the image
        Returns:
        the image
        Throws:
        java.lang.RuntimeException - if failed to load or render SVG file
      • svg2image

        public static java.awt.image.BufferedImage svg2image​(java.lang.String svgName,
                                                             float scaleFactor)
        Creates a buffered image and renders the given SVG into it.
        Parameters:
        svgName - the name of the SVG resource (a '/'-separated path)
        scaleFactor - the amount by which the SVG size is scaled
        Returns:
        the image
        Throws:
        java.lang.RuntimeException - if failed to load or render SVG file
      • svg2image

        public static java.awt.image.BufferedImage svg2image​(com.kitfox.svg.SVGDiagram diagram,
                                                             int width,
                                                             int height)
        Creates a buffered image and renders the given SVGDiagram into it.
        Parameters:
        diagram - the SVG diagram
        width - the width of the image
        height - the height of the image
        Returns:
        the image
        Throws:
        java.lang.RuntimeException - if failed to render SVG file