Class ImageTools

java.lang.Object
uk.ac.gda.ui.utils.ImageTools

public class ImageTools extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.eclipse.swt.graphics.RGB
    getDominantColour(org.eclipse.swt.graphics.Image image)
     
    static org.eclipse.swt.graphics.Image
    getRotatedImage(org.eclipse.swt.graphics.Image image, int rotationDegrees)
    Generate rotated image Origin is top left of image, image is rotated clockwise starting from 3 o'clock position.
    static org.eclipse.swt.graphics.Image
    replaceColour(org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.RGB targetColour, org.eclipse.swt.graphics.RGB replacementColour, int threshold)
    Replace 'target' colour in an image with a different colour.
    static org.eclipse.swt.graphics.Image
    setTransparentPixels(org.eclipse.swt.graphics.Image image, int threshold)
     
    static org.eclipse.swt.graphics.Image
    setTransparentPixels(org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.RGB transparentColour, int threshold)
    Generate a new image with specific colour set to transparent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getRotatedImage

      public static org.eclipse.swt.graphics.Image getRotatedImage(org.eclipse.swt.graphics.Image image, int rotationDegrees)
      Generate rotated image Origin is top left of image, image is rotated clockwise starting from 3 o'clock position.
      Parameters:
      image -
      rotationDegrees - - rotation angle wrt 3 o'clock position (can be +ve or -ve).
      Returns:
      rotated image
    • setTransparentPixels

      public static org.eclipse.swt.graphics.Image setTransparentPixels(org.eclipse.swt.graphics.Image image, int threshold)
    • setTransparentPixels

      public static org.eclipse.swt.graphics.Image setTransparentPixels(org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.RGB transparentColour, int threshold)
      Generate a new image with specific colour set to transparent
      Parameters:
      image -
      transparentColour - - colour to set to transparent (usually white, e.g RGB(255,255,255))
      threshold - pixels with RGB components exceeding this value will be set the transparent (set to zero to ignore)
      Returns:
      new image with transparency
    • replaceColour

      public static org.eclipse.swt.graphics.Image replaceColour(org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.RGB targetColour, org.eclipse.swt.graphics.RGB replacementColour, int threshold)
      Replace 'target' colour in an image with a different colour.
      Parameters:
      image -
      targetColour - RGB colour to be replaced
      replacementColour - RGB replacement colour
      threshold -
      Returns:
      new image with the colours replaced
    • getDominantColour

      public static org.eclipse.swt.graphics.RGB getDominantColour(org.eclipse.swt.graphics.Image image)