waba.fx
Class Color

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

public final class Color
extends java.lang.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
           
static Color BLUE
           
protected  Color bright
           
static Color BRIGHT
           
static Color CYAN
           
protected  Color dark
           
static Color DARK
           
 int equ
          for fast comparisions. 2 colors are equal if their equ have the same value
protected  int gray
           
protected  int green
           
static Color GREEN
           
static Color MAGENTA
           
static Color ORANGE
           
static Color PINK
           
protected  int red
           
static Color RED
           
protected  int rgb
           
static Color WHITE
           
static int WHITE_PIXEL
           
static Color YELLOW
           
 
Constructor Summary
Color(int rgb)
          Deprecated. Color is now a singleton. Use Color.getColor instead.
Color(int red, int green, int blue)
          Deprecated. Color is now a singleton. Use Color.getColor instead.
Color(java.lang.String rrggbb)
          Deprecated. Color is now a singleton. Use Color.getColor instead.
 
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(java.lang.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.
static Color getColor(int rgb)
          Constructs a color object with the given rgb
static Color getColor(int red, int green, int blue)
          Constructs a color object with the given red, green and blue components.
static Color getColor(java.lang.String rrggbb)
          Constructs a color object with the given rgb
 Color getCursorColor()
          Returns the best cursor color depending on this 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
 Color halfDarker()
          return a color that is even less darker than the current one. if grayscale, returns the following darker color
 int hashCode()
          returns the best hash code for this color (equ)
 Color lessBrighter()
          return a color that is less brighter than the current one. if grayscale, returns the following brighter color
 Color lessDarker()
          return a color that is less darker than the current one. if grayscale, returns the following darker color
 java.lang.String toString()
          Returns the string representation of this color: the rgb in hexadecimal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, 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

WHITE

public static final Color WHITE

BRIGHT

public static final Color BRIGHT

DARK

public static final Color DARK

BLACK

public static final Color BLACK

RED

public static final Color RED

PINK

public static final Color PINK

ORANGE

public static final Color ORANGE

YELLOW

public static final Color YELLOW

GREEN

public static final Color GREEN

MAGENTA

public static final Color MAGENTA

CYAN

public static final Color CYAN

BLUE

public static final Color BLUE

WHITE_PIXEL

public static final int WHITE_PIXEL
Constructor Detail

Color

public Color(int red,
             int green,
             int blue)
Deprecated. Color is now a singleton. Use Color.getColor instead.

Constructs a color object with the given red, green and blue components.
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)
Deprecated. Color is now a singleton. Use Color.getColor instead.

Constructs a color object with the given rgb
Parameters:
rgb - a color in the format 0x00RRGGBB

Color

public Color(java.lang.String rrggbb)
Deprecated. Color is now a singleton. Use Color.getColor instead.

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

getColor

public static Color getColor(int red,
                             int green,
                             int blue)
Constructs a color object with the given red, green and blue components.
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
Since:
SuperWaba 5.8

getColor

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

getColor

public static Color getColor(java.lang.String rrggbb)
Constructs a color object with the given rgb
Parameters:
rrggbb - a string in the format RRGGBB (colors in hex).
Since:
SuperWaba 5.8

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 java.lang.Object

equals

public boolean equals(java.lang.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 java.lang.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

lessBrighter

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

lessDarker

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

halfDarker

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

getCursorColor

public Color getCursorColor()
Returns the best cursor color depending on this 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 java.lang.String toString()
Returns the string representation of this color: the rgb in hexadecimal
Overrides:
toString in class java.lang.Object