Java Doc for Color.java in  » 6.0-JDK-Core » AWT » java » awt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.Color

All known Subclasses:   java.awt.SystemColor,
Color
public class Color implements Paint,java.io.Serializable(Code)
The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary color spaces identified by a ColorSpace . Every color has an implicit alpha value of 1.0 or an explicit one provided in the constructor. The alpha value defines the transparency of a color and can be represented by a float value in the range 0.0 - 1.0 or 0 - 255. An alpha value of 1.0 or 255 means that the color is completely opaque and an alpha value of 0 or 0.0 means that the color is completely transparent. When constructing a Color with an explicit alpha or getting the color/alpha components of a Color, the color components are never premultiplied by the alpha component.

The default color space for the Java 2D(tm) API is sRGB, a proposed standard RGB color space. For further information on sRGB, see http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html .


version:
   10 Feb 1997
author:
   Sami Shaio
author:
   Arthur van Hoff
See Also:   ColorSpace
See Also:   AlphaComposite



Field Summary
final public static  ColorBLACK
     The color black.
final public static  ColorBLUE
     The color blue.
final public static  ColorCYAN
     The color cyan.
final public static  ColorDARK_GRAY
     The color dark gray.
final public static  ColorGRAY
     The color gray.
final public static  ColorGREEN
     The color green.
final public static  ColorLIGHT_GRAY
     The color light gray.
final public static  ColorMAGENTA
     The color magenta.
final public static  ColorORANGE
     The color orange.
final public static  ColorPINK
     The color pink.
final public static  ColorRED
     The color red.
final public static  ColorWHITE
     The color white.
final public static  ColorYELLOW
     The color yellow.
final public static  Colorblack
     The color black.
final public static  Colorblue
     The color blue.
final public static  Colorcyan
     The color cyan.
final public static  ColordarkGray
     The color dark gray.
final public static  Colorgray
     The color gray.
final public static  Colorgreen
     The color green.
final public static  ColorlightGray
     The color light gray.
final public static  Colormagenta
     The color magenta.
final public static  Colororange
     The color orange.
final public static  Colorpink
     The color pink.
final public static  Colorred
     The color red.
 intvalue
     The color value.
final public static  Colorwhite
     The color white.
final public static  Coloryellow
     The color yellow.

Constructor Summary
public  Color(int r, int g, int b)
     Creates an opaque sRGB color with the specified red, green, and blue values in the range (0 - 255).
public  Color(int r, int g, int b, int a)
     Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 - 255).
public  Color(int rgb)
     Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.
public  Color(int rgba, boolean hasalpha)
     Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.
public  Color(float r, float g, float b)
     Creates an opaque sRGB color with the specified red, green, and blue values in the range (0.0 - 1.0).
public  Color(float r, float g, float b, float a)
     Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0.0 - 1.0).
public  Color(ColorSpace cspace, float components, float alpha)
     Creates a color in the specified ColorSpace with the color components specified in the float array and the specified alpha.

Method Summary
public static  intHSBtoRGB(float hue, float saturation, float brightness)
     Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model.
public static  float[]RGBtoHSB(int r, int g, int b, float[] hsbvals)
     Converts the components of a color, as specified by the default RGB model, to an equivalent set of values for hue, saturation, and brightness that are the three components of the HSB model.
public  Colorbrighter()
     Creates a new Color that is a brighter version of this Color.

This method applies an arbitrary scale factor to each of the three RGB components of this Color to create a brighter version of this Color.

public synchronized  PaintContextcreateContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints)
     Creates and returns a PaintContext used to generate a solid color pattern.
public  Colordarker()
     Creates a new Color that is a darker version of this Color.

This method applies an arbitrary scale factor to each of the three RGB components of this Color to create a darker version of this Color.

public static  Colordecode(String nm)
     Converts a String to an integer and returns the specified opaque Color.
public  booleanequals(Object obj)
     Determines whether another object is equal to this Color.

The result is true if and only if the argument is not null and is a Color object that has the same red, green, blue, and alpha values as this object.

public  intgetAlpha()
     Returns the alpha component in the range 0-255.
public  intgetBlue()
     Returns the blue component in the range 0-255 in the default sRGB space.
public static  ColorgetColor(String nm)
     Finds a color in the system properties.
public static  ColorgetColor(String nm, Color v)
     Finds a color in the system properties.
public static  ColorgetColor(String nm, int v)
     Finds a color in the system properties.
public  float[]getColorComponents(float[] compArray)
     Returns a float array containing only the color components of the Color, in the ColorSpace of the Color. If compArray is null, an array with length equal to the number of components in the associated ColorSpace is created for the return value.
public  float[]getColorComponents(ColorSpace cspace, float[] compArray)
     Returns a float array containing only the color components of the Color in the ColorSpace specified by the cspace parameter.
public  ColorSpacegetColorSpace()
     Returns the ColorSpace of this Color.
public  float[]getComponents(float[] compArray)
     Returns a float array containing the color and alpha components of the Color, in the ColorSpace of the Color. If compArray is null, an array with length equal to the number of components in the associated ColorSpace plus one is created for the return value.
public  float[]getComponents(ColorSpace cspace, float[] compArray)
     Returns a float array containing the color and alpha components of the Color, in the ColorSpace specified by the cspace parameter.
public  intgetGreen()
     Returns the green component in the range 0-255 in the default sRGB space.
public static  ColorgetHSBColor(float h, float s, float b)
     Creates a Color object based on the specified values for the HSB color model.
public  intgetRGB()
     Returns the RGB value representing the color in the default sRGB ColorModel .
public  float[]getRGBColorComponents(float[] compArray)
     Returns a float array containing only the color components of the Color, in the default sRGB color space.
public  float[]getRGBComponents(float[] compArray)
     Returns a float array containing the color and alpha components of the Color, as represented in the default sRGB color space. If compArray is null, an array of length 4 is created for the return value.
public  intgetRed()
     Returns the red component in the range 0-255 in the default sRGB space.
public  intgetTransparency()
     Returns the transparency mode for this Color.
public  inthashCode()
     Computes the hash code for this Color.
public  StringtoString()
     Returns a string representation of this Color.

Field Detail
BLACK
final public static Color BLACK(Code)
The color black. In the default sRGB space.
since:
   1.4



BLUE
final public static Color BLUE(Code)
The color blue. In the default sRGB space.
since:
   1.4



CYAN
final public static Color CYAN(Code)
The color cyan. In the default sRGB space.
since:
   1.4



DARK_GRAY
final public static Color DARK_GRAY(Code)
The color dark gray. In the default sRGB space.
since:
   1.4



GRAY
final public static Color GRAY(Code)
The color gray. In the default sRGB space.
since:
   1.4



GREEN
final public static Color GREEN(Code)
The color green. In the default sRGB space.
since:
   1.4



LIGHT_GRAY
final public static Color LIGHT_GRAY(Code)
The color light gray. In the default sRGB space.
since:
   1.4



MAGENTA
final public static Color MAGENTA(Code)
The color magenta. In the default sRGB space.
since:
   1.4



ORANGE
final public static Color ORANGE(Code)
The color orange. In the default sRGB space.
since:
   1.4



PINK
final public static Color PINK(Code)
The color pink. In the default sRGB space.
since:
   1.4



RED
final public static Color RED(Code)
The color red. In the default sRGB space.
since:
   1.4



WHITE
final public static Color WHITE(Code)
The color white. In the default sRGB space.
since:
   1.4



YELLOW
final public static Color YELLOW(Code)
The color yellow. In the default sRGB space.
since:
   1.4



black
final public static Color black(Code)
The color black. In the default sRGB space.



blue
final public static Color blue(Code)
The color blue. In the default sRGB space.



cyan
final public static Color cyan(Code)
The color cyan. In the default sRGB space.



darkGray
final public static Color darkGray(Code)
The color dark gray. In the default sRGB space.



gray
final public static Color gray(Code)
The color gray. In the default sRGB space.



green
final public static Color green(Code)
The color green. In the default sRGB space.



lightGray
final public static Color lightGray(Code)
The color light gray. In the default sRGB space.



magenta
final public static Color magenta(Code)
The color magenta. In the default sRGB space.



orange
final public static Color orange(Code)
The color orange. In the default sRGB space.



pink
final public static Color pink(Code)
The color pink. In the default sRGB space.



red
final public static Color red(Code)
The color red. In the default sRGB space.



value
int value(Code)
The color value.
See Also:   Color.getRGB



white
final public static Color white(Code)
The color white. In the default sRGB space.



yellow
final public static Color yellow(Code)
The color yellow. In the default sRGB space.




Constructor Detail
Color
public Color(int r, int g, int b)(Code)
Creates an opaque sRGB color with the specified red, green, and blue values in the range (0 - 255). The actual color used in rendering depends on finding the best match given the color space available for a given output device. Alpha is defaulted to 255.
throws:
  IllegalArgumentException - if r, gor b are outside of the range0 to 255, inclusive
Parameters:
  r - the red component
Parameters:
  g - the green component
Parameters:
  b - the blue component
See Also:   Color.getRed
See Also:   Color.getGreen
See Also:   Color.getBlue
See Also:   Color.getRGB



Color
public Color(int r, int g, int b, int a)(Code)
Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 - 255).
throws:
  IllegalArgumentException - if r, g,b or a are outside of the range0 to 255, inclusive
Parameters:
  r - the red component
Parameters:
  g - the green component
Parameters:
  b - the blue component
Parameters:
  a - the alpha component
See Also:   Color.getRed
See Also:   Color.getGreen
See Also:   Color.getBlue
See Also:   Color.getAlpha
See Also:   Color.getRGB



Color
public Color(int rgb)(Code)
Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. The actual color used in rendering depends on finding the best match given the color space available for a particular output device. Alpha is defaulted to 255.
Parameters:
  rgb - the combined RGB components
See Also:   java.awt.image.ColorModel.getRGBdefault
See Also:   Color.getRed
See Also:   Color.getGreen
See Also:   Color.getBlue
See Also:   Color.getRGB



Color
public Color(int rgba, boolean hasalpha)(Code)
Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. If the hasalpha argument is false, alpha is defaulted to 255.
Parameters:
  rgba - the combined RGBA components
Parameters:
  hasalpha - true if the alpha bits are valid;false otherwise
See Also:   java.awt.image.ColorModel.getRGBdefault
See Also:   Color.getRed
See Also:   Color.getGreen
See Also:   Color.getBlue
See Also:   Color.getAlpha
See Also:   Color.getRGB



Color
public Color(float r, float g, float b)(Code)
Creates an opaque sRGB color with the specified red, green, and blue values in the range (0.0 - 1.0). Alpha is defaulted to 1.0. The actual color used in rendering depends on finding the best match given the color space available for a particular output device.
throws:
  IllegalArgumentException - if r, gor b are outside of the range0.0 to 1.0, inclusive
Parameters:
  r - the red component
Parameters:
  g - the green component
Parameters:
  b - the blue component
See Also:   Color.getRed
See Also:   Color.getGreen
See Also:   Color.getBlue
See Also:   Color.getRGB



Color
public Color(float r, float g, float b, float a)(Code)
Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0.0 - 1.0). The actual color used in rendering depends on finding the best match given the color space available for a particular output device.
throws:
  IllegalArgumentException - if r, gb or a are outside of the range0.0 to 1.0, inclusive
Parameters:
  r - the red component
Parameters:
  g - the green component
Parameters:
  b - the blue component
Parameters:
  a - the alpha component
See Also:   Color.getRed
See Also:   Color.getGreen
See Also:   Color.getBlue
See Also:   Color.getAlpha
See Also:   Color.getRGB



Color
public Color(ColorSpace cspace, float components, float alpha)(Code)
Creates a color in the specified ColorSpace with the color components specified in the float array and the specified alpha. The number of components is determined by the type of the ColorSpace. For example, RGB requires 3 components, but CMYK requires 4 components.
Parameters:
  cspace - the ColorSpace to be used tointerpret the components
Parameters:
  components - an arbitrary number of color componentsthat is compatible with the ColorSpace
Parameters:
  alpha - alpha value
throws:
  IllegalArgumentException - if any of the values in the components array or alpha is outside of the range 0.0 to 1.0
See Also:   Color.getComponents
See Also:   Color.getColorComponents




Method Detail
HSBtoRGB
public static int HSBtoRGB(float hue, float saturation, float brightness)(Code)
Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model.

The saturation and brightness components should be floating-point values between zero and one (numbers in the range 0.0-1.0). The hue component can be any floating-point number. The floor of this number is subtracted from it to create a fraction between 0 and 1. This fractional number is then multiplied by 360 to produce the hue angle in the HSB color model.

The integer that is returned by HSBtoRGB encodes the value of a color in bits 0-23 of an integer value that is the same format used by the method Color.getRGB() getRGB . This integer can be supplied as an argument to the Color constructor that takes a single integer argument.
Parameters:
  hue - the hue component of the color
Parameters:
  saturation - the saturation of the color
Parameters:
  brightness - the brightness of the color the RGB value of the color with the indicated hue, saturation, and brightness.
See Also:   java.awt.Color.getRGB
See Also:   java.awt.Color.Color(int)
See Also:   java.awt.image.ColorModel.getRGBdefault
since:
   JDK1.0




RGBtoHSB
public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals)(Code)
Converts the components of a color, as specified by the default RGB model, to an equivalent set of values for hue, saturation, and brightness that are the three components of the HSB model.

If the hsbvals argument is null, then a new array is allocated to return the result. Otherwise, the method returns the array hsbvals, with the values put into that array.
Parameters:
  r - the red component of the color
Parameters:
  g - the green component of the color
Parameters:
  b - the blue component of the color
Parameters:
  hsbvals - the array used to return the three HSB values, or null an array of three elements containing the hue, saturation, and brightness (in that order), of the color with the indicated red, green, and blue components.
See Also:   java.awt.Color.getRGB
See Also:   java.awt.Color.Color(int)
See Also:   java.awt.image.ColorModel.getRGBdefault
since:
   JDK1.0




brighter
public Color brighter()(Code)
Creates a new Color that is a brighter version of this Color.

This method applies an arbitrary scale factor to each of the three RGB components of this Color to create a brighter version of this Color. Although brighter and darker are inverse operations, the results of a series of invocations of these two methods might be inconsistent because of rounding errors. a new Color object that is a brighter version of this Color.
See Also:   java.awt.Color.darker
since:
   JDK1.0




createContext
public synchronized PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints)(Code)
Creates and returns a PaintContext used to generate a solid color pattern. This enables a Color object to be used as an argument to any method requiring an object implementing the Paint interface. The same PaintContext is returned, regardless of whether or not r, r2d, xform, or hints are null.
Parameters:
  cm - the specified ColorModel
Parameters:
  r - the specified Rectangle
Parameters:
  r2d - the specified Rectangle2D
Parameters:
  xform - the specified AffineTransform
Parameters:
  hints - the specified RenderingHints a PaintContext that is used to generate asolid color pattern.
See Also:   Paint
See Also:   PaintContext
See Also:   Graphics2D.setPaint



darker
public Color darker()(Code)
Creates a new Color that is a darker version of this Color.

This method applies an arbitrary scale factor to each of the three RGB components of this Color to create a darker version of this Color. Although brighter and darker are inverse operations, the results of a series of invocations of these two methods might be inconsistent because of rounding errors. a new Color object that is a darker version of this Color.
See Also:   java.awt.Color.brighter
since:
   JDK1.0




decode
public static Color decode(String nm) throws NumberFormatException(Code)
Converts a String to an integer and returns the specified opaque Color. This method handles string formats that are used to represent octal and hexadecimal numbers.
Parameters:
  nm - a String that represents an opaque color as a 24-bit integer the new Color object.
See Also:   java.lang.Integer.decode
exception:
  NumberFormatException - if the specified string cannotbe interpreted as a decimal, octal, or hexadecimal integer.
since:
   JDK1.1



equals
public boolean equals(Object obj)(Code)
Determines whether another object is equal to this Color.

The result is true if and only if the argument is not null and is a Color object that has the same red, green, blue, and alpha values as this object.
Parameters:
  obj - the object to test for equality with thisColor true if the objects are the same; false otherwise.
since:
   JDK1.0




getAlpha
public int getAlpha()(Code)
Returns the alpha component in the range 0-255. the alpha component.
See Also:   Color.getRGB



getBlue
public int getBlue()(Code)
Returns the blue component in the range 0-255 in the default sRGB space. the blue component.
See Also:   Color.getRGB



getColor
public static Color getColor(String nm)(Code)
Finds a color in the system properties.

The argument is treated as the name of a system property to be obtained. The string value of this property is then interpreted as an integer which is then converted to a Color object.

If the specified property is not found or could not be parsed as an integer then null is returned.
Parameters:
  nm - the name of the color property the Color converted from the system property.
See Also:   java.lang.System.getProperty(java.lang.String)
See Also:   java.lang.Integer.getInteger(java.lang.String)
See Also:   java.awt.Color.Color(int)
since:
   JDK1.0




getColor
public static Color getColor(String nm, Color v)(Code)
Finds a color in the system properties.

The first argument is treated as the name of a system property to be obtained. The string value of this property is then interpreted as an integer which is then converted to a Color object.

If the specified property is not found or cannot be parsed as an integer then the Color specified by the second argument is returned instead.
Parameters:
  nm - the name of the color property
Parameters:
  v - the default Color the Color converted from the systemproperty, or the specified Color.
See Also:   java.lang.System.getProperty(java.lang.String)
See Also:   java.lang.Integer.getInteger(java.lang.String)
See Also:   java.awt.Color.Color(int)
since:
   JDK1.0




getColor
public static Color getColor(String nm, int v)(Code)
Finds a color in the system properties.

The first argument is treated as the name of a system property to be obtained. The string value of this property is then interpreted as an integer which is then converted to a Color object.

If the specified property is not found or could not be parsed as an integer then the integer value v is used instead, and is converted to a Color object.
Parameters:
  nm - the name of the color property
Parameters:
  v - the default color value, as an integer the Color converted from the systemproperty or the Color converted fromthe specified integer.
See Also:   java.lang.System.getProperty(java.lang.String)
See Also:   java.lang.Integer.getInteger(java.lang.String)
See Also:   java.awt.Color.Color(int)
since:
   JDK1.0




getColorComponents
public float[] getColorComponents(float[] compArray)(Code)
Returns a float array containing only the color components of the Color, in the ColorSpace of the Color. If compArray is null, an array with length equal to the number of components in the associated ColorSpace is created for the return value. Otherwise, compArray must have at least this length and it is filled in with the components and returned.
Parameters:
  compArray - an array that this method fills with the colorcomponents of this Color in itsColorSpace and returns the color components in a float array.



getColorComponents
public float[] getColorComponents(ColorSpace cspace, float[] compArray)(Code)
Returns a float array containing only the color components of the Color in the ColorSpace specified by the cspace parameter. If compArray is null, an array with length equal to the number of components in cspace is created for the return value. Otherwise, compArray must have at least this length, and it is filled in with the components and returned.
Parameters:
  cspace - a specified ColorSpace
Parameters:
  compArray - an array that this method fills with the colorcomponents of this Color in the specifiedColorSpace the color components in a float array.



getColorSpace
public ColorSpace getColorSpace()(Code)
Returns the ColorSpace of this Color. this Color object's ColorSpace.



getComponents
public float[] getComponents(float[] compArray)(Code)
Returns a float array containing the color and alpha components of the Color, in the ColorSpace of the Color. If compArray is null, an array with length equal to the number of components in the associated ColorSpace plus one is created for the return value. Otherwise, compArray must have at least this length and it is filled in with the components and returned.
Parameters:
  compArray - an array that this method fills with the color andalpha components of this Color in itsColorSpace and returns the color and alpha components in a float array.



getComponents
public float[] getComponents(ColorSpace cspace, float[] compArray)(Code)
Returns a float array containing the color and alpha components of the Color, in the ColorSpace specified by the cspace parameter. If compArray is null, an array with length equal to the number of components in cspace plus one is created for the return value. Otherwise, compArray must have at least this length, and it is filled in with the components and returned.
Parameters:
  cspace - a specified ColorSpace
Parameters:
  compArray - an array that this method fills with thecolor and alpha components of this Color inthe specified ColorSpace and returns the color and alpha components in a float array.



getGreen
public int getGreen()(Code)
Returns the green component in the range 0-255 in the default sRGB space. the green component.
See Also:   Color.getRGB



getHSBColor
public static Color getHSBColor(float h, float s, float b)(Code)
Creates a Color object based on the specified values for the HSB color model.

The s and b components should be floating-point values between zero and one (numbers in the range 0.0-1.0). The h component can be any floating-point number. The floor of this number is subtracted from it to create a fraction between 0 and 1. This fractional number is then multiplied by 360 to produce the hue angle in the HSB color model.
Parameters:
  h - the hue component
Parameters:
  s - the saturation of the color
Parameters:
  b - the brightness of the color a Color object with the specified hue, saturation, and brightness.
since:
   JDK1.0




getRGB
public int getRGB()(Code)
Returns the RGB value representing the color in the default sRGB ColorModel . (Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue). the RGB value of the color in the default sRGBColorModel.
See Also:   java.awt.image.ColorModel.getRGBdefault
See Also:   Color.getRed
See Also:   Color.getGreen
See Also:   Color.getBlue
since:
   JDK1.0



getRGBColorComponents
public float[] getRGBColorComponents(float[] compArray)(Code)
Returns a float array containing only the color components of the Color, in the default sRGB color space. If compArray is null, an array of length 3 is created for the return value. Otherwise, compArray must have length 3 or greater, and it is filled in with the components and returned.
Parameters:
  compArray - an array that this method fills with color components and returns the RGB components in a float array.



getRGBComponents
public float[] getRGBComponents(float[] compArray)(Code)
Returns a float array containing the color and alpha components of the Color, as represented in the default sRGB color space. If compArray is null, an array of length 4 is created for the return value. Otherwise, compArray must have length 4 or greater, and it is filled in with the components and returned.
Parameters:
  compArray - an array that this method fills with color and alpha components and returns the RGBA components in a float array.



getRed
public int getRed()(Code)
Returns the red component in the range 0-255 in the default sRGB space. the red component.
See Also:   Color.getRGB



getTransparency
public int getTransparency()(Code)
Returns the transparency mode for this Color. This is required to implement the Paint interface. this Color object's transparency mode.
See Also:   Paint
See Also:   Transparency
See Also:   Color.createContext



hashCode
public int hashCode()(Code)
Computes the hash code for this Color. a hash code value for this object.
since:
   JDK1.0



toString
public String toString()(Code)
Returns a string representation of this Color. This method is intended to be used only for debugging purposes. The content and format of the returned string might vary between implementations. The returned string might be empty but cannot be null. a string representation of this Color.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.