|
Modifier and Type |
Method and Description |
|
brighter |
Creates a new Color that is a brighter version of this
Color .
-
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 .
The alpha value is preserved.
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.
- Returns:
- a new
Color object that is
a brighter version of this Color
with the same alpha value. - Since:
- JDK1.0
- See Also:
darker()
|
|
createContext |
PaintContext createContext(java.awt.image.ColorModel cm,
Rectangle r,
java.awt.geom.Rectangle2D r2d,
java.awt.geom.AffineTransform xform,
RenderingHints hints)
Creates and returns a PaintContext used to
generate a solid color field pattern.
-
Creates and returns a PaintContext used to
generate a solid color field pattern.
See the specification of the
method in the Paint interface for information
on null parameter handling.
- Specified by:
createContext in interface Paint
- Parameters:
cm - the preferred ColorModel which represents the most convenient
format for the caller to receive the pixel data, or null
if there is no preference.r - the device space bounding box
of the graphics primitive being rendered.r2d - the user space bounding box
of the graphics primitive being rendered.xform - the AffineTransform from user
space into device space.hints - the set of hints that the context object can use to
choose between rendering alternatives.
- Returns:
- the
PaintContext for
generating color patterns. - See Also:
Paint ,
PaintContext ,
ColorModel ,
Rectangle ,
Rectangle2D ,
AffineTransform ,
RenderingHints
|
|
darker |
Creates a new Color that is a darker version of this
Color .
-
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 .
The alpha value is preserved.
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.
- Returns:
- a new
Color object that is
a darker version of this Color
with the same alpha value. - Since:
- JDK1.0
- See Also:
brighter()
|
|
equals |
boolean equals(java.lang.Object obj)
Determines whether another object is equal to this
Color .
public boolean equals(java.lang.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.
- Overrides:
equals in class java.lang.Object
- Parameters:
obj - the object to test for equality with this
Color
- Returns:
true if the objects are the same;
false otherwise.- Since:
- JDK1.0
- See Also:
Object.hashCode() ,
HashMap
|
|
getAlpha |
int getAlpha()
Returns the alpha component in the range 0-255.
public int getAlpha()
-
Returns the alpha component in the range 0-255.
- Returns:
- the alpha component.
- See Also:
getRGB()
|
|
getBlue |
int getBlue()
Returns the blue component in the range 0-255 in the default sRGB
space.
public int getBlue()
-
Returns the blue component in the range 0-255 in the default sRGB
space.
- Returns:
- the blue component.
- See Also:
getRGB()
|
|
getColorComponents |
float[] getColorComponents(java.awt.color.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 float[] getColorComponents(java.awt.color.ColorSpace cspace,
float[] compArray)
-
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 compArray - an array that this method fills with the color
components of this Color in the specified
ColorSpace
- Returns:
- the color components in a
float array.
|
|
getColorComponents |
float[] getColorComponents(float[] compArray)
Returns a float array containing only the color
components of the Color , in the
ColorSpace of the Color .
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. 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
components of this Color in its
ColorSpace and returns
- Returns:
- the color components in a
float array.
|
|
getColorSpace |
java.awt.color.ColorSpace getColorSpace()
Returns the ColorSpace of this Color .
public java.awt.color.ColorSpace getColorSpace()
-
Returns the ColorSpace of this Color .
- Returns:
- this
Color object's ColorSpace .
|
|
getComponents |
float[] getComponents(java.awt.color.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 float[] getComponents(java.awt.color.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. 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 compArray - an array that this method fills with the
color and alpha components of this Color in
the specified ColorSpace and returns
- Returns:
- the color and alpha components in a
float
array.
|
|
getComponents |
float[] getComponents(float[] compArray)
Returns a float array containing the color and alpha
components of the Color , in the
ColorSpace of the 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. 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 and
alpha components of this Color in its
ColorSpace and returns
- Returns:
- the color and alpha components in a
float
array.
|
|
getGreen |
int getGreen()
Returns the green component in the range 0-255 in the default sRGB
space.
public int getGreen()
-
Returns the green component in the range 0-255 in the default sRGB
space.
- Returns:
- the green component.
- See Also:
getRGB()
|
|
getRed |
int getRed()
Returns the red component in the range 0-255 in the default sRGB
space.
public int getRed()
-
Returns the red component in the range 0-255 in the default sRGB
space.
- Returns:
- the red component.
- See Also:
getRGB()
|
|
getRGB |
int getRGB()
Returns the RGB value representing the color in the default sRGB
ColorModel .
public int getRGB()
-
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).
- Returns:
- the RGB value of the color in the default sRGB
ColorModel . - Since:
- JDK1.0
- See Also:
ColorModel.getRGBdefault() ,
getRed() ,
getGreen() ,
getBlue()
|
|
getRGBColorComponents |
float[] getRGBColorComponents(float[] compArray)
Returns a float array containing only the color
components of the Color , in the default sRGB color
space.
public float[] getRGBColorComponents(float[] compArray)
-
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
- Returns:
- the RGB components in a
float array.
|
|
getRGBComponents |
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.
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. 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
- Returns:
- the RGBA components in a
float array.
|
|
getTransparency |
int getTransparency()
Returns the transparency mode for this Color .
|
|
hashCode |
int hashCode()
Computes the hash code for this Color .
public int hashCode()
-
Computes the hash code for this Color .
- Overrides:
hashCode in class java.lang.Object
- Returns:
- a hash code value for this object.
- Since:
- JDK1.0
- See Also:
Object.equals(java.lang.Object) ,
System.identityHashCode(java.lang.Object)
|
|
toString |
java.lang.String toString()
Returns a string representation of this Color .
public java.lang.String toString()
-
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 .
- Overrides:
toString in class java.lang.Object
- Returns:
- a string representation of this
Color .
|