utils
Class ImageUtils

java.lang.Object
  extended by utils.ImageUtils

public class ImageUtils
extends java.lang.Object

This class provides various methods that help with the image processing tasks


Constructor Summary
ImageUtils()
           
 
Method Summary
static java.awt.image.BufferedImage applyBlending(java.awt.image.BufferedImage image, java.awt.Composite compositeToUse, int red, int green, int blue)
          Apply the desired blending to the given image with the given color
static org.eclipse.swt.graphics.ImageData applyBlendingSWT(java.awt.image.BufferedImage image, java.awt.Composite compositeToUse, int red, int green, int blue)
          Apply the desired blending to the given image with the given color
static java.awt.image.BufferedImage convertToAWT(org.eclipse.swt.graphics.ImageData data)
          Converts a given SWT ImageData into a AWT BufferedImage
static org.eclipse.swt.graphics.ImageData convertToSWT(java.awt.image.BufferedImage awt)
          Converts a given AWT BufferedImage into a SWT ImageData
static java.awt.image.BufferedImage createSoftClipping(java.awt.image.BufferedImage sourceImage, java.awt.Shape clippingShape)
          Create a soft clipped image of a given image using a given clipping shape
static double getResizingRatio(java.awt.image.BufferedImage image, int desiredWidth, int desiredHeight)
          Returns the resizing ratio that is needed to scale the given image so that will fit inside the desired dimension with at least one of it's length (width/height) equal to given one.
static double getResizingRatio(double imageWidth, double imageHeight, int desiredWidth, int desiredHeight)
           
 
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

applyBlendingSWT

public static org.eclipse.swt.graphics.ImageData applyBlendingSWT(java.awt.image.BufferedImage image,
                                                                  java.awt.Composite compositeToUse,
                                                                  int red,
                                                                  int green,
                                                                  int blue)
Apply the desired blending to the given image with the given color

Parameters:
image - the source image for the blending
compositeToUse - the composite to be used by the blending
red - an 0-255 INT value for the red channel
green - an 0-255 INT value for the green channel
blue - an 0-255 INT value for the blue channel
Returns:
the new blended SWT image data

applyBlending

public static java.awt.image.BufferedImage applyBlending(java.awt.image.BufferedImage image,
                                                         java.awt.Composite compositeToUse,
                                                         int red,
                                                         int green,
                                                         int blue)
Apply the desired blending to the given image with the given color

Parameters:
image - the source image for the blending
compositeToUse - the composite to be used by the blending
red - an 0-255 INT value for the red channel
green - an 0-255 INT value for the green channel
blue - an 0-255 INT value for the blue channel
Returns:
the new blended BufferedImage

convertToAWT

public static java.awt.image.BufferedImage convertToAWT(org.eclipse.swt.graphics.ImageData data)
Converts a given SWT ImageData into a AWT BufferedImage

Parameters:
data - the SWT image data
Returns:
the equivalent AWT buffered image

convertToSWT

public static final org.eclipse.swt.graphics.ImageData convertToSWT(java.awt.image.BufferedImage awt)
Converts a given AWT BufferedImage into a SWT ImageData

Parameters:
awt - the AWT buffered image
Returns:
the equivalent SWT image data

getResizingRatio

public static double getResizingRatio(java.awt.image.BufferedImage image,
                                      int desiredWidth,
                                      int desiredHeight)
Returns the resizing ratio that is needed to scale the given image so that will fit inside the desired dimension with at least one of it's length (width/height) equal to given one.

Parameters:
image - the source image
desiredWidth - the desired width of the given image
desiredHeight - the desired height of the given image
Returns:
the resizing ratio

getResizingRatio

public static double getResizingRatio(double imageWidth,
                                      double imageHeight,
                                      int desiredWidth,
                                      int desiredHeight)

createSoftClipping

public static java.awt.image.BufferedImage createSoftClipping(java.awt.image.BufferedImage sourceImage,
                                                              java.awt.Shape clippingShape)
Create a soft clipped image of a given image using a given clipping shape

Parameters:
sourceImage - the image from which clipping will be created
clippingShape - the shape used to do the clipping
Returns:
the clipped image