android.image
Class ColorDatabase

java.lang.Object
  extended by android.image.ColorDatabase

public class ColorDatabase
extends java.lang.Object

Manages color names and translation to implementation-dependent Color structures.

Available colors are listed in the following table. If an undefined color is used then a RuntimeException is thrown. Custom colors can be created using the static makeColor methods.

Alternatively clients can specify a 7 character string beginning with a '#' (hash-mark) followed by a 6 digit hexadecimal number that encodes the requested RGB color, e.g., "#FF0000" for Red, or "#00FF00" for Green. For advanced users, a 9 character string beginning with a '#' followed by an 8 digit hexadecimal number that encodes the requested ARGB color (Alpha, Red, Green, Blue), e.g., "#FFFF0000" for Opaque Red, or "#8800FF00" for Half-Transparent Green.

Color names are case-insensitive.

"orange red"     
"orangered"     
"tomato"     
"darkred"     
"red"     
"firebrick"     
"crimson"     
"deeppink"     
"maroon"     
"indian red"     
"indianred"     
"medium violet red"     
"mediumvioletred"     
"violet red"     
"violetred"     
"lightcoral"     
"hotpink"     
"palevioletred"     
"lightpink"     
"rosybrown"     
"pink"     
"orchid"     
"lavenderblush"     
"snow"     
"chocolate"     
"saddlebrown"     
"brown"     
"darkorange"     
"coral"     
"sienna"     
"orange"     
"salmon"     
"peru"     
"darkgoldenrod"     
"goldenrod"     
"sandybrown"     
"lightsalmon"     
"darksalmon"     
"gold"     
"yellow"     
"olive"     
"burlywood"     
"tan"     
"navajowhite"     
"peachpuff"     
"khaki"     
"darkkhaki"     
"moccasin"     
"wheat"     
"bisque"     
"palegoldenrod"     
"blanchedalmond"     
"medium goldenrod"     
"mediumgoldenrod"     
"papayawhip"     
"mistyrose"     
"lemonchiffon"     
"antiquewhite"     
"cornsilk"     
"lightgoldenrodyellow"     
"oldlace"     
"linen"     
"lightyellow"     
"seashell"     
"beige"     
"floralwhite"     
"ivory"     
"green"     
"lawngreen"     
"chartreuse"     
"green yellow"     
"greenyellow"     
"yellow green"     
"yellowgreen"     
"medium forest green"     
"olivedrab"     
"mediumforestgreen"     
"dark olive green"     
"darkolivegreen"     
"darkseagreen"     
"lime"     
"dark green"     
"darkgreen"     
"lime green"     
"limegreen"     
"forest green"     
"forestgreen"     
"spring green"     
"springgreen"     
"medium spring green"     
"mediumspringgreen"     
"sea green"     
"seagreen"     
"medium sea green"     
"mediumseagreen"     
"aquamarine"     
"lightgreen"     
"pale green"     
"palegreen"     
"medium aquamarine"     
"mediumaquamarine"     
"turquoise"     
"lightseagreen"     
"medium turquoise"     
"mediumturquoise"     
"honeydew"     
"mintcream"     
"royalblue"     
"dodgerblue"     
"deepskyblue"     
"cornflowerblue"     
"steel blue"     
"steelblue"     
"lightskyblue"     
"dark turquoise"     
"darkturquoise"     
"cyan"     
"aqua"     
"darkcyan"     
"teal"     
"sky blue"     
"skyblue"     
"cadet blue"     
"cadetblue"     
"dark slate gray"     
"darkslategray"     
"lightslategray"     
"slategray"     
"dark slate grey"     
"darkslategrey"     
"lightslategrey"     
"slategrey"     
"light steel blue"     
"lightsteelblue"     
"light blue"     
"lightblue"     
"powderblue"     
"paleturquoise"     
"lightcyan"     
"aliceblue"     
"azure"     
"medium blue"     
"mediumblue"     
"darkblue"     
"midnight blue"     
"midnightblue"     
"navy"     
"blue"     
"indigo"     
"blue violet"     
"blueviolet"     
"medium slate blue"     
"mediumslateblue"     
"slate blue"     
"slateblue"     
"purple"     
"dark slate blue"     
"darkslateblue"     
"darkviolet"     
"dark orchid"     
"darkorchid"     
"mediumpurple"     
"cornflower blue"     
"medium orchid"     
"mediumorchid"     
"magenta"     
"fuchsia"     
"darkmagenta"     
"violet"     
"plum"     
"lavender"     
"thistle"     
"ghostwhite"     
"white"     
"whitesmoke"     
"gainsboro"     
"light gray"     
"lightgray"     
"light grey"     
"lightgrey"     
"silver"     
"gray"     
"dark gray"     
"darkgray"     
"dim gray"     
"dimgray"     
"dark grey"     
"darkgrey"     
"dim grey"     
"dimgrey"     
"black"     


Constructor Summary
ColorDatabase()
           
 
Method Summary
static int argbAlpha(int color)
          Get the Alpha component of an integer Color in the ARGB format.
static int argbBlue(int color)
          Get the Blue component of an integer Color in the ARGB format.
static int argbGreen(int color)
          Get the Green component of an integer Color in the ARGB format.
static int argbRed(int color)
          Get the Red component of an integer Color in the ARGB format.
static int color(java.lang.String s)
          Get the java.awt.Color represented by the given string
static int colorToARGB(double red, double green, double blue)
          Convert the given Color intensities into ARGB integer format.
static int colorToARGB(double alpha, double red, double green, double blue)
          Convert the given Alpha and Color intensities into ARGB integer format.
static int colorToARGB(int red, int green, int blue)
          Convert the given Color intensities into ARGB integer format.
static int colorToARGB(int alpha, int red, int green, int blue)
          Convert the given Alpha and Color intensities into ARGB integer format.
static int colorToARGB(java.lang.String c)
          Convert the given Color String into ARGB integer format.
static java.lang.String makeColor(double red, double green, double blue)
          Create a color String from the given Red/Green/Blue fractional intensities in [0..1.0].
static java.lang.String makeColor(double alpha, double red, double green, double blue)
          Create a color String from the given Alpha/Red/Green/Blue fractional intensities in [0..1.0].
static java.lang.String makeColor(int color)
          Create a color String from the given integer that encodes Alpha/Red/Green/Blue intensities.
static java.lang.String makeColor(int red, int green, int blue)
          Create a color String from the given Alpha/Red/Green/Blue intensities in [0..255].
static java.lang.String makeColor(int alpha, int red, int green, int blue)
          Create a color String from the given Alpha/Red/Green/Blue intensities in [0..255].
static int parseColor(java.lang.String c)
          Parse a hex-Color from a 6 digit String (two each for Red, Green, Blue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorDatabase

public ColorDatabase()
Method Detail

color

public static int color(java.lang.String s)
Get the java.awt.Color represented by the given string


makeColor

public static java.lang.String makeColor(int red,
                                         int green,
                                         int blue)
Create a color String from the given Alpha/Red/Green/Blue intensities in [0..255].


makeColor

public static java.lang.String makeColor(int alpha,
                                         int red,
                                         int green,
                                         int blue)
Create a color String from the given Alpha/Red/Green/Blue intensities in [0..255].


makeColor

public static java.lang.String makeColor(double red,
                                         double green,
                                         double blue)
Create a color String from the given Red/Green/Blue fractional intensities in [0..1.0].


makeColor

public static java.lang.String makeColor(double alpha,
                                         double red,
                                         double green,
                                         double blue)
Create a color String from the given Alpha/Red/Green/Blue fractional intensities in [0..1.0].


colorToARGB

public static int colorToARGB(java.lang.String c)
Convert the given Color String into ARGB integer format.


colorToARGB

public static int colorToARGB(double red,
                              double green,
                              double blue)
Convert the given Color intensities into ARGB integer format. RGB intensities must be between 0 and 1.0, inclusive.


colorToARGB

public static int colorToARGB(double alpha,
                              double red,
                              double green,
                              double blue)
Convert the given Alpha and Color intensities into ARGB integer format. ARGB intensities must be between 0 and 1.0, inclusive.


colorToARGB

public static int colorToARGB(int red,
                              int green,
                              int blue)
Convert the given Color intensities into ARGB integer format. RGB intensities must be between 0 and 255, inclusive.


colorToARGB

public static int colorToARGB(int alpha,
                              int red,
                              int green,
                              int blue)
Convert the given Alpha and Color intensities into ARGB integer format. ARGB intensities must be between 0 and 255, inclusive.


makeColor

public static java.lang.String makeColor(int color)
Create a color String from the given integer that encodes Alpha/Red/Green/Blue intensities. Each of the low-order bytes encodes an intensity in [0..255] where the Red/Green/Blue/Alpha are in order from high to low order bytes.


argbAlpha

public static int argbAlpha(int color)
Get the Alpha component of an integer Color in the ARGB format.


argbRed

public static int argbRed(int color)
Get the Red component of an integer Color in the ARGB format.


argbGreen

public static int argbGreen(int color)
Get the Green component of an integer Color in the ARGB format.


argbBlue

public static int argbBlue(int color)
Get the Blue component of an integer Color in the ARGB format.


parseColor

public static int parseColor(java.lang.String c)
Parse a hex-Color from a 6 digit String (two each for Red, Green, Blue