org.jhotdraw.color
Class CompositeColor
- java.lang.Object
-
- java.awt.Color
-
- org.jhotdraw.color.CompositeColor
-
- All Implemented Interfaces:
- java.awt.Paint, java.awt.Transparency, java.io.Serializable
public class CompositeColor extends java.awt.ColorCompositeColoris identical tojava.awt.Colorwith the exception that it allows to construct an instance with color components outside of the range of 0 and 1.- See Also:
- Serialized Form
-
-
Field Summary
-
Constructor Summary
Constructors Constructor and Description CompositeColor(java.awt.color.ColorSpace cspace, float[] components, float alpha)Creates a color in the specifiedColorSpacewith the color components specified in thefloatarray and the specified alpha.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description float[]getColorComponents(java.awt.color.ColorSpace cspace, float[] compArray)Returns afloatarray containing only the color components of theColorin theColorSpacespecified by thecspaceparameter.float[]getColorComponents(float[] compArray)Returns afloatarray containing only the color components of theColor, in theColorSpaceof theColor.java.awt.color.ColorSpacegetColorSpace()Returns theColorSpaceof thisColor.float[]getComponents(java.awt.color.ColorSpace cspace, float[] compArray)Returns afloatarray containing the color and alpha components of theColor, in theColorSpacespecified by thecspaceparameter.float[]getComponents(float[] compArray)Returns afloatarray containing the color and alpha components of theColor, in theColorSpaceof theColor.
-
-
-
Constructor Detail
-
CompositeColor
public CompositeColor(java.awt.color.ColorSpace cspace, float[] components, float alpha)Creates a color in the specifiedColorSpacewith the color components specified in thefloatarray and the specified alpha. The number of components is determined by the type of theColorSpace. For example, RGB requires 3 components, but CMYK requires 4 components.- Parameters:
cspace- theColorSpaceto be used to interpret the componentscomponents- an arbitrary number of color components that is compatible with theColorSpacealpha- alpha value- Throws:
java.lang.IllegalArgumentException- if any of the values in thecomponentsarray oralphais outside of the range supported by cspace.- See Also:
getComponents(float[]),getColorComponents(float[])
-
-
Method Detail
-
getComponents
public float[] getComponents(float[] compArray)
Returns afloatarray containing the color and alpha components of theColor, in theColorSpaceof theColor. IfcompArrayisnull, an array with length equal to the number of components in the associatedColorSpaceplus one is created for the return value. Otherwise,compArraymust have at least this length and it is filled in with the components and returned.- Overrides:
getComponentsin classjava.awt.Color- Parameters:
compArray- an array that this method fills with the color and alpha components of thisColorin itsColorSpaceand returns- Returns:
- the color and alpha components in a
floatarray.
-
getColorComponents
public float[] getColorComponents(float[] compArray)
Returns afloatarray containing only the color components of theColor, in theColorSpaceof theColor. IfcompArrayisnull, an array with length equal to the number of components in the associatedColorSpaceis created for the return value. Otherwise,compArraymust have at least this length and it is filled in with the components and returned.- Overrides:
getColorComponentsin classjava.awt.Color- Parameters:
compArray- an array that this method fills with the color components of thisColorin itsColorSpaceand returns- Returns:
- the color components in a
floatarray.
-
getComponents
public float[] getComponents(java.awt.color.ColorSpace cspace, float[] compArray)Returns afloatarray containing the color and alpha components of theColor, in theColorSpacespecified by thecspaceparameter. IfcompArrayisnull, an array with length equal to the number of components incspaceplus one is created for the return value. Otherwise,compArraymust have at least this length, and it is filled in with the components and returned.- Overrides:
getComponentsin classjava.awt.Color- Parameters:
cspace- a specifiedColorSpacecompArray- an array that this method fills with the color and alpha components of thisColorin the specifiedColorSpaceand returns- Returns:
- the color and alpha components in a
floatarray.
-
getColorComponents
public float[] getColorComponents(java.awt.color.ColorSpace cspace, float[] compArray)Returns afloatarray containing only the color components of theColorin theColorSpacespecified by thecspaceparameter. IfcompArrayisnull, an array with length equal to the number of components incspaceis created for the return value. Otherwise,compArraymust have at least this length, and it is filled in with the components and returned.- Overrides:
getColorComponentsin classjava.awt.Color- Parameters:
cspace- a specifiedColorSpacecompArray- an array that this method fills with the color components of thisColorin the specifiedColorSpace- Returns:
- the color components in a
floatarray.
-
getColorSpace
public java.awt.color.ColorSpace getColorSpace()
Returns theColorSpaceof thisColor.- Overrides:
getColorSpacein classjava.awt.Color- Returns:
- this
Colorobject'sColorSpace.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG