Class ImageConverter

java.lang.Object
org.eclipse.graphiti.export.batik.ImageConverter

public class ImageConverter extends Object
This is a helper class used to convert an SWT Image into an AWT BufferedImage. This class is originally from GMF and was adapted for Graphiti needs.
  • Constructor Details

    • ImageConverter

      public ImageConverter()
  • Method Details

    • convert

      public static org.eclipse.swt.graphics.Image convert(BufferedImage srcImage)
      Converts an AWT based buffered image into an SWT Image. This will always return an Image that has 24 bit depth regardless of the type of AWT buffered image that is passed into the method.
      Parameters:
      srcImage - the BufferedImage to be converted to an Image
      Returns:
      an Image that represents the same image data as the AWT BufferedImage type.
    • convertToImageData

      public static org.eclipse.swt.graphics.ImageData convertToImageData(BufferedImage srcImage)
      Converts an AWT based buffered image into an SWT ImageData. This will always return an ImageData that has 24 bit depth regardless of the type of AWT buffered image that is passed into the method.
      Parameters:
      srcImage - the BufferedImage to be converted to an Image
      Returns:
      an Image that represents the same image data as the AWT BufferedImage type.
      Since:
      1.3.1
    • convert

      public static BufferedImage convert(org.eclipse.swt.graphics.Image srcImage)
      Converts an swt based image into an AWT BufferedImage. This will always return a BufferedImage that is of type BufferedImage.TYPE_INT_ARGB regardless of the type of swt image that is passed into the method.
      Parameters:
      srcImage - the Image to be converted to a BufferedImage
      Returns:
      a BufferedImage that represents the same image data as the swt Image
    • convertFromImageData

      public static BufferedImage convertFromImageData(org.eclipse.swt.graphics.ImageData imageData)
      Converts an swt based image data into an AWT BufferedImage. This will always return a BufferedImage that is of type BufferedImage.TYPE_INT_ARGB regardless of the type of swt image that is passed into the method.
      Parameters:
      imageData - the Image to be converted to a BufferedImage
      Returns:
      a BufferedImage that represents the same image data as the swt Image
      Since:
      1.3.1