Interface IImageExporter

All Known Implementing Classes:
ImageExport

public interface IImageExporter
Interface to an SVG rendering service. An IImageExporter object has methods for converting SVG source (String) to PNG or JPEG format and either return an InputStream to read the image's bytes, or write the image bytes to a given OutputStream.
  • Method Summary

    Modifier and Type
    Method
    Description
    getJPEG(String svgString, Float quality)
    Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-created BufferedImage, and returns an InputStream for reading the BufferedImage in JPEG format at the given quality level.
    getPNG(String svgString)
    Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-created BufferedImage, and returns an InputStream for reading the BufferedImage in PNG format.
    void
    writeJPEG(OutputStream os, String svgString, Float quality)
    Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-created BufferedImage, and writes the BufferedImage as a JPEG to os at the given quality level.
    void
    writePNG(OutputStream os, String svgString)
    Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-created BufferedImage, and writes the BufferedImage as a PNG to os.
  • Method Details

    • writePNG

      void writePNG(OutputStream os, String svgString) throws IOException
      Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-created BufferedImage, and writes the BufferedImage as a PNG to os.
      Parameters:
      os - the OutputStream where the PNG data is written.
      svgString - the SVG graphic source.
      Throws:
      IOException
    • writeJPEG

      void writeJPEG(OutputStream os, String svgString, Float quality) throws IOException
      Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-created BufferedImage, and writes the BufferedImage as a JPEG to os at the given quality level.
      Parameters:
      os - the OutputStream where the JPEG data is written.
      svgString - the SVG graphic source.
      quality - a number between 0 and 1, with 1 representing the best quality and 0 representing the least quality but smallest file size. Pass null to use the default quality.
      Throws:
      IOException
    • getPNG

      InputStream getPNG(String svgString) throws IOException
      Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-created BufferedImage, and returns an InputStream for reading the BufferedImage in PNG format.
      Parameters:
      svgString - the SVG graphic source.
      Returns:
      an InputStream for reading a rasterization of the SVG graphic in PNG format.
      Throws:
      IOException
    • getJPEG

      InputStream getJPEG(String svgString, Float quality) throws IOException
      Parses the given SVG graphic source, paints the parsed SVG graphic into a newly-created BufferedImage, and returns an InputStream for reading the BufferedImage in JPEG format at the given quality level.
      Parameters:
      svgString - the SVG graphic source.
      quality - a number between 0 and 1, with 1 representing the best quality and 0 representing the least quality but smallest file size. Pass null to use the default quality.
      Returns:
      an InputStream for reading a rasterization of the SVG graphic in JPEG format.
      Throws:
      IOException