public class CompositeColor
extends java.awt.Color
CompositeColor
is identical to java.awt.Color
with
the exception that it allows to construct an instance with color components
outside of the range of 0 and 1.Constructor and Description |
---|
CompositeColor(java.awt.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. |
Modifier and Type | Method and Description |
---|---|
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. |
float[] |
getColorComponents(float[] compArray)
Returns a
float array containing only the color
components of the Color , in the
ColorSpace of the Color . |
java.awt.color.ColorSpace |
getColorSpace()
Returns the
ColorSpace of this Color . |
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. |
float[] |
getComponents(float[] compArray)
Returns a
float array containing the color and alpha
components of the Color , in the
ColorSpace of the Color . |
public CompositeColor(java.awt.color.ColorSpace cspace, float[] components, float alpha)
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.cspace
- the ColorSpace
to be used to
interpret the componentscomponents
- an arbitrary number of color components
that is compatible with the ColorSpace
alpha
- alpha valuejava.lang.IllegalArgumentException
- if any of the values in the
components
array or alpha
is
outside of the range supported by cspace.getComponents(float[])
,
getColorComponents(float[])
public float[] getComponents(float[] compArray)
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.getComponents
in class java.awt.Color
compArray
- an array that this method fills with the color and
alpha components of this Color
in its
ColorSpace
and returnsfloat
array.public float[] getColorComponents(float[] compArray)
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.getColorComponents
in class java.awt.Color
compArray
- an array that this method fills with the color
components of this Color
in its
ColorSpace
and returnsfloat
array.public float[] getComponents(java.awt.color.ColorSpace cspace, float[] compArray)
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.getComponents
in class java.awt.Color
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 returnsfloat
array.public float[] getColorComponents(java.awt.color.ColorSpace cspace, float[] compArray)
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.getColorComponents
in class java.awt.Color
cspace
- a specified ColorSpace
compArray
- an array that this method fills with the color
components of this Color
in the specified
ColorSpace
float
array.public java.awt.color.ColorSpace getColorSpace()
ColorSpace
of this Color
.getColorSpace
in class java.awt.Color
Color
object's ColorSpace
.