com.sencha.gxt.chart.client.draw
Class RGB

java.lang.Object
  extended by com.sencha.gxt.chart.client.draw.Color
      extended by com.sencha.gxt.chart.client.draw.RGB

public class RGB
extends Color

Represents an RGB color.


Field Summary
static RGB BLACK
          0, 0, 0
static RGB BLUE
          0, 0, 255
static RGB CYAN
          0, 255, 255
static RGB DARKGRAY
          169, 169, 169
static RGB GRAY
          128, 128, 128
static RGB GREEN
          0, 128, 0
static RGB LIGHTGRAY
          211, 211, 211
static RGB MAGENTA
          255, 0, 255
static RGB ORANGE
          255, 165, 0
static RGB PINK
          252, 192, 203
static RGB PURPLE
          128, 0, 128
static RGB RED
          255, 0, 0
static RGB WHITE
          255, 255, 255
static RGB YELLOW
          255, 255, 0
 
Fields inherited from class com.sencha.gxt.chart.client.draw.Color
NONE
 
Constructor Summary
RGB()
          Creates an instance of RGB with default values.
RGB(HSL hsl)
          Creates an RGB instance using the given HSL color.
RGB(HSV hsv)
          Creates an RGB instance using the given HSV color.
RGB(int red, int green, int blue)
          Creates an RGB instance using the given RGB values.
RGB(RGB rgb)
          Creates an RGB instance using the given RGB color.
RGB(String hex)
          Creates an RGB instance using the given hexadecimal string.
 
Method Summary
 boolean equals(Object obj)
           
 int getBlue()
          Get the blue widget of the color, in the range 0..255.
 String getColor()
          Returns the literal string of the color.
 RGB getDarker(double factor)
          Return a new color that is darker than this color.
 double getGrayScale()
          Returns the gray value (0 to 255) of the color.
 int getGreen()
          Get the green widget of the color, in the range 0..255.
 RGB getLighter(double factor)
          Return a new color that is lighter than this color.
 int getRed()
          Get the red widget of the color, in the range 0..255.
 List<Integer> getRGB()
          Get the RGB values.
 void setBlue(int blue)
          Sets the blue value of the RGB color
 void setGreen(int green)
          Sets the green value of the RGB color
 void setRed(int red)
          Sets the red value of the RGB color
 String toString()
          Return the color in String format.
 
Methods inherited from class com.sencha.gxt.chart.client.draw.Color
setColor
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BLACK

public static final RGB BLACK
0, 0, 0


BLUE

public static final RGB BLUE
0, 0, 255


CYAN

public static final RGB CYAN
0, 255, 255


DARKGRAY

public static final RGB DARKGRAY
169, 169, 169


GRAY

public static final RGB GRAY
128, 128, 128


GREEN

public static final RGB GREEN
0, 128, 0


LIGHTGRAY

public static final RGB LIGHTGRAY
211, 211, 211


MAGENTA

public static final RGB MAGENTA
255, 0, 255


ORANGE

public static final RGB ORANGE
255, 165, 0


PINK

public static final RGB PINK
252, 192, 203


PURPLE

public static final RGB PURPLE
128, 0, 128


RED

public static final RGB RED
255, 0, 0


YELLOW

public static final RGB YELLOW
255, 255, 0


WHITE

public static final RGB WHITE
255, 255, 255

Constructor Detail

RGB

public RGB()
Creates an instance of RGB with default values.


RGB

public RGB(HSL hsl)
Creates an RGB instance using the given HSL color.

Parameters:
hsl - the HSL color

RGB

public RGB(HSV hsv)
Creates an RGB instance using the given HSV color.

Parameters:
hsv - the HSV color

RGB

public RGB(int red,
           int green,
           int blue)
Creates an RGB instance using the given RGB values.

Parameters:
red - the red value (0..255)
green - the green value (0..255)
blue - the blue value (0..255)

RGB

public RGB(RGB rgb)
Creates an RGB instance using the given RGB color.

Parameters:
rgb - the RGB color

RGB

public RGB(String hex)
Creates an RGB instance using the given hexadecimal string.

Parameters:
hex - supports "#xxx" or "#xxxxxx"
Method Detail

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getBlue

public int getBlue()
Get the blue widget of the color, in the range 0..255.

Returns:
the blue widget

getColor

public String getColor()
Description copied from class: Color
Returns the literal string of the color.

Overrides:
getColor in class Color
Returns:
the literal string of the color

getDarker

public RGB getDarker(double factor)
Return a new color that is darker than this color.

Parameters:
factor - Darker factor (0..1), default to 0.2
Returns:
darker color

getGrayScale

public double getGrayScale()
Returns the gray value (0 to 255) of the color. The gray value is calculated using the formula r*0.3 + g*0.59 + b*0.11.

Returns:
the gray value of the color

getGreen

public int getGreen()
Get the green widget of the color, in the range 0..255.

Returns:
the green widget

getLighter

public RGB getLighter(double factor)
Return a new color that is lighter than this color.

Parameters:
factor - Lighter factor (0..1), default to 0.2
Returns:
lighter color

getRed

public int getRed()
Get the red widget of the color, in the range 0..255.

Returns:
the red widget

getRGB

public List<Integer> getRGB()
Get the RGB values.

Returns:
list of the rgb values

setBlue

public void setBlue(int blue)
Sets the blue value of the RGB color

Parameters:
blue - the blue value of the RGB color

setGreen

public void setGreen(int green)
Sets the green value of the RGB color

Parameters:
green - the green value of the RGB color

setRed

public void setRed(int red)
Sets the red value of the RGB color

Parameters:
red - the red value of the RGB color

toString

public String toString()
Description copied from class: Color
Return the color in String format.

Overrides:
toString in class Color
Returns:
string value


Copyright © 2011. All Rights Reserved.