org.eclipse.graphiti.export.batik
Class ImageConverter

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

public class ImageConverter
extends java.lang.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.


Field Summary
private static PaletteData PALETTE_DATA
           
 
Constructor Summary
ImageConverter()
           
 
Method Summary
static Image convert(java.awt.image.BufferedImage srcImage)
          Converts an AWT based buffered image into an SWT Image.
static java.awt.image.BufferedImage convertFromImageData(ImageData imageData)
          Converts an swt based image data into an AWT BufferedImage.
static ImageData convertToImageData(java.awt.image.BufferedImage srcImage)
          Converts an AWT based buffered image into an SWT ImageData.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PALETTE_DATA

private static final PaletteData PALETTE_DATA
Constructor Detail

ImageConverter

public ImageConverter()
Method Detail

convert

public static Image convert(java.awt.image.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 ImageData convertToImageData(java.awt.image.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

convertFromImageData

public static java.awt.image.BufferedImage convertFromImageData(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 org.eclipse.swt.graphics.Image to be converted to a BufferedImage
Returns:
a BufferedImage that represents the same image data as the swt Image
Since:
1.3.1


Copyright (c) SAP AG 2005, 2012.