waba.fx
Class Color

java.lang.Object
  |
  +--waba.fx.Color

public final class Color
extends Object

Color represents a color.

A color is defined as a mixture of red, green and blue color values. Each value is in the range of 0 to 255 where 0 is darkest and 255 is brightest. For example, Color(255, 0, 0) is the color red.

Here are some more examples:


Field Summary
static Color BLACK
           
protected  int blue
           
protected  Color bright
           
static Color BRIGHT
           
protected  Color dark
           
static Color DARK
           
static Color defaultBackColor
           
static Color defaultForeColor
           
 int equ
          for fast comparisions. 2 colors are equal if their equ have the same value
static int fadeStep
           
protected  int gray
           
protected  int green
           
protected  int red
           
protected  int rgb
           
static int smallerFadeStep
           
static Color WHITE
           
 
Constructor Summary
Color(int rgb)
          Constructs a color object with the given rgb
Color(int red, int green, int blue)
          Constructs a color object with the given red, green and blue values.
Color(String rrggbb)
          Constructs a color object with the given rgb
 
Method Summary
 Color brighter()
          return a color that is brighter than the current one. if grayscale, returns the following brighter color
 Color brighter(int step)
          return a color that is brighter than the current one. if grayscale, returns the following brighter color
 Color darker()
          return a color that is darker than the current one. if grayscale, returns the following darker color
 Color darker(int step)
          return a color that is darker than the current one. if grayscale, returns the following darker color
 boolean equals(Object obj)
          Returns true if this color equals to the other color. if in grayScale mode, returns true if both grayValues are equal.
 int getAlpha()
          Returns the alpha channel of this Color in a value from 0 to 255
 int getBlue()
          Returns the blue value of the color.
 Color getCursorColor()
          Returns the best cursor color depending on the color
 int getGray()
          Returns this index of the color in gray scale mode.
 int getGreen()
          Returns the green value of the color.
 int getRed()
          Returns the red value of the color.
 int getRGB()
          Returns the current color as 0x00RRGGBB
 int hashCode()
          returns the best hash code for this color (equ)
 String toString()
          Returns the string representation of this color: the rgb in hexadecimal
 
Methods inherited from class java.lang.Object
getClass, notify, wait, wait
 

Field Detail

red

protected int red

green

protected int green

blue

protected int blue

rgb

protected int rgb

gray

protected int gray

equ

public int equ
for fast comparisions. 2 colors are equal if their equ have the same value

bright

protected Color bright

dark

protected Color dark

fadeStep

public static int fadeStep

smallerFadeStep

public static int smallerFadeStep

WHITE

public static final Color WHITE

BRIGHT

public static final Color BRIGHT

DARK

public static final Color DARK

BLACK

public static final Color BLACK

defaultForeColor

public static Color defaultForeColor

defaultBackColor

public static Color defaultBackColor
Constructor Detail

Color

public Color(int red,
             int green,
             int blue)
Constructs a color object with the given red, green and blue values.
Parameters:
red - the red value in the range of 0 to 255
green - the green value in the range of 0 to 255
blue - the blue value in the range of 0 to 255

Color

public Color(int rgb)
Constructs a color object with the given rgb
Parameters:
rgb - a color in the format 0x00RRGGBB

Color

public Color(String rrggbb)
Constructs a color object with the given rgb
Parameters:
rgb - a string in the format RRGGBB (colors in hex).
Method Detail

getAlpha

public int getAlpha()
Returns the alpha channel of this Color in a value from 0 to 255

getBlue

public int getBlue()
Returns the blue value of the color.

getGreen

public int getGreen()
Returns the green value of the color.

getRed

public int getRed()
Returns the red value of the color.

getGray

public int getGray()
Returns this index of the color in gray scale mode. Since gray scale mode range from 4 to 16 colors, it may return indexes from 0 to 15, depending on the device.
Since:
SuperWaba2.0

getRGB

public int getRGB()
Returns the current color as 0x00RRGGBB

hashCode

public int hashCode()
returns the best hash code for this color (equ)
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Returns true if this color equals to the other color. if in grayScale mode, returns true if both grayValues are equal.
Overrides:
equals in class Object

brighter

public Color brighter()
return a color that is brighter than the current one. if grayscale, returns the following brighter color

darker

public Color darker()
return a color that is darker than the current one. if grayscale, returns the following darker color

brighter

public Color brighter(int step)
return a color that is brighter than the current one. if grayscale, returns the following brighter color

darker

public Color darker(int step)
return a color that is darker than the current one. if grayscale, returns the following darker color

toString

public String toString()
Returns the string representation of this color: the rgb in hexadecimal
Overrides:
toString in class Object

getCursorColor

public Color getCursorColor()
Returns the best cursor color depending on the color