Package uk.ac.gda.ui.utils
Class ImageTools
java.lang.Object
uk.ac.gda.ui.utils.ImageTools
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.eclipse.swt.graphics.RGBgetDominantColour(org.eclipse.swt.graphics.Image image) static org.eclipse.swt.graphics.ImagegetRotatedImage(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.ImagereplaceColour(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.ImagesetTransparentPixels(org.eclipse.swt.graphics.Image image, int threshold) static org.eclipse.swt.graphics.ImagesetTransparentPixels(org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.RGB transparentColour, int threshold) Generate a new image with specific colour set to transparent
-
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 replacedreplacementColour- RGB replacement colourthreshold-- Returns:
- new image with the colours replaced
-
getDominantColour
public static org.eclipse.swt.graphics.RGB getDominantColour(org.eclipse.swt.graphics.Image image)
-