org.shapelogic.color
Class ColorUtil

java.lang.Object
  extended by org.shapelogic.color.ColorUtil

public class ColorUtil
extends java.lang.Object

Contains all the color utility methods that are missing in ImageJ.

Author:
Sami Badawi

Field Summary
static int BLUE_MASK
           
static int BLUE_POS
           
static int GREEN_MASK
           
static int GREEN_OFFSET
           
static int GREEN_POS
           
static int RED_MASK
           
static int RED_OFFSET
           
static int RED_POS
           
 
Constructor Summary
ColorUtil()
           
 
Method Summary
static int blueOrRgbToGray(int red, int green, int blue)
          When you have RGB input but need a gray result.
static java.lang.String colorToString(int color, boolean rgb)
           
static int grayToRGB(int gray)
           
static int packColors(int[] colors)
           
static int packColors(int red, int green, int blue)
           
static int rgbToGray(int colorIn)
          Change an RGB color to a gray value.
static int splitBlue(int colorIn)
          Split blue from int.
static int[] splitColor(int colorIn)
          Split color coded as int into 3 int.
static int[] splitColor(int colorIn, int[] iArray)
          Split color coded as int into 3 int.
static int splitGreen(int colorIn)
          Split green from int.
static int splitRed(int colorIn)
          Split red from int.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLUE_MASK

public static final int BLUE_MASK
See Also:
Constant Field Values

GREEN_MASK

public static final int GREEN_MASK
See Also:
Constant Field Values

RED_MASK

public static final int RED_MASK
See Also:
Constant Field Values

RED_POS

public static final int RED_POS
See Also:
Constant Field Values

GREEN_POS

public static final int GREEN_POS
See Also:
Constant Field Values

BLUE_POS

public static final int BLUE_POS
See Also:
Constant Field Values

GREEN_OFFSET

public static final int GREEN_OFFSET
See Also:
Constant Field Values

RED_OFFSET

public static final int RED_OFFSET
See Also:
Constant Field Values
Constructor Detail

ColorUtil

public ColorUtil()
Method Detail

splitColor

public static int[] splitColor(int colorIn)
Split color coded as int into 3 int.


splitColor

public static int[] splitColor(int colorIn,
                               int[] iArray)
Split color coded as int into 3 int.


splitRed

public static int splitRed(int colorIn)
Split red from int.


splitGreen

public static int splitGreen(int colorIn)
Split green from int.


splitBlue

public static int splitBlue(int colorIn)
Split blue from int.


packColors

public static int packColors(int red,
                             int green,
                             int blue)

packColors

public static int packColors(int[] colors)

grayToRGB

public static int grayToRGB(int gray)

rgbToGray

public static int rgbToGray(int colorIn)
Change an RGB color to a gray value. Based on the perceived contribution to the brightness.


blueOrRgbToGray

public static int blueOrRgbToGray(int red,
                                  int green,
                                  int blue)
When you have RGB input but need a gray result. If only the blue is set use that, otherwise do normal color transform. Based on the perceived contribution to the brightness.


colorToString

public static java.lang.String colorToString(int color,
                                             boolean rgb)


Copyright © 2009. All Rights Reserved.