com.ibm.tivoli.maximo.report.control

Class ImageUtils

  • java.lang.Object
    • com.ibm.tivoli.maximo.report.control.ImageUtils


  • public class ImageUtils
    extends java.lang.Object
    ImageUtils contains some utility methods for converting base64 and svg data into images, and for compositing the 2 images to create a new image. This was created to facilitate downloading dojo charts from the web UI, which are SVG + HTML.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ImageUtils() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.awt.image.BufferedImage compositeImages(java.awt.image.BufferedImage src, int dx, int dy, java.awt.image.BufferedImage overlay)
      Overlay 2 images, with the given offset dx,dy for the overlay image.
      void createCompositeImage(java.lang.String imageDataUri, int dx, int dy, java.lang.String svgImageData, java.io.OutputStream output)
      Convenience method that overlays a SVG image on top of a base64 encoded image and writes the output to the output stream.
      java.awt.image.BufferedImage toImageFromDataURI(java.lang.String imageData)
      Given the Base64 encoded image URI (data:image/png;base64,iVBORw0KG...) create a BufferedImage
      java.awt.image.BufferedImage toImageFromSVG(java.lang.String svg)
      Given the SVG xml, create a BufferedImage.
      • Methods inherited from class java.lang.Object

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

      • ImageUtils

        public ImageUtils()
    • Method Detail

      • toImageFromDataURI

        public java.awt.image.BufferedImage toImageFromDataURI(java.lang.String imageData)
                                                        throws java.io.IOException
        Given the Base64 encoded image URI (data:image/png;base64,iVBORw0KG...) create a BufferedImage
        Parameters:
        imageData -
        Returns:
        Throws:
        java.io.IOException
      • toImageFromSVG

        public java.awt.image.BufferedImage toImageFromSVG(java.lang.String svg)
                                                    throws java.lang.Exception
        Given the SVG xml, create a BufferedImage.
        Parameters:
        svg -
        Returns:
        Throws:
        TranscoderException
        java.io.IOException
        java.lang.Exception
      • compositeImages

        public java.awt.image.BufferedImage compositeImages(java.awt.image.BufferedImage src,
                                                            int dx,
                                                            int dy,
                                                            java.awt.image.BufferedImage overlay)
        Overlay 2 images, with the given offset dx,dy for the overlay image. For the dojo charts... the underlying html is converted to a base image, and then we need to overlay the svg chart image on top of that, to create a new image that includes the original html view + chart. (ie, sometimes labels and headers are in html, but we need/want, that data to be in the final "png" image.
        Parameters:
        src -
        dx -
        dy -
        overlay -
        Returns:
      • createCompositeImage

        public void createCompositeImage(java.lang.String imageDataUri,
                                         int dx,
                                         int dy,
                                         java.lang.String svgImageData,
                                         java.io.OutputStream output)
                                  throws java.lang.Exception
        Convenience method that overlays a SVG image on top of a base64 encoded image and writes the output to the output stream.
        Parameters:
        imageDataUri -
        dx -
        dy -
        svgImageData -
        output -
        Throws:
        java.io.IOException
        TranscoderException
        java.lang.Exception