Class LinearColorInterpolator
java.lang.Object
org.biojava.nbio.structure.gui.util.color.LinearColorInterpolator
- All Implemented Interfaces:
ColorInterpolator
- Author:
- Spencer Bliven
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioninterpolate(Color a, Color b, float mixing) Interpolates to a color between a and bvoidsetColorSpace(ColorSpace colorSpace) voidsetColorSpace(ColorSpace colorSpace, LinearColorInterpolator.InterpolationDirection[] dir) Sets the ColorSpace to use for interpolation.voidsetInterpolationDirection(int componentIndex, LinearColorInterpolator.InterpolationDirection dir)
-
Constructor Details
-
LinearColorInterpolator
public LinearColorInterpolator() -
LinearColorInterpolator
-
-
Method Details
-
interpolate
Interpolates to a color between a and b- Specified by:
interpolatein interfaceColorInterpolator- Parameters:
a- First colorb- Second colormixing- Mixing coefficient; the fraction of a in the result.- Returns:
- The color between a and b
- Throws:
IllegalArgumentException- if mixing is not between 0 and 1- See Also:
-
setColorSpace
public void setColorSpace(ColorSpace colorSpace, LinearColorInterpolator.InterpolationDirection[] dir) Sets the ColorSpace to use for interpolation. The most common scheme for color spaces is to use linear components between 0 and 1 (for instance red,green,blue). For such a component, a linear interpolation between two colors is used. Sometimes a component may be in cylindrical coordinates. In this case, the component can be mapped in a number of ways. These are set by InterpolationDirections.- Parameters:
colorSpace- The color space for interpolationinterpDirection- An array of size colorSpace.getNumComponents() giving the interpolation direction for each component.
-
setColorSpace
-
setInterpolationDirection
public void setInterpolationDirection(int componentIndex, LinearColorInterpolator.InterpolationDirection dir)
-