Class ColorCurve
ColorCurve class is a container to provide color and tonality
information. The main use of instances of this class is done in the
MultitoneOp class, which uses instances of this class to convey
information of colors and tonality of those colors to mix together.
Instances of this class contain a Color value and a tonality
curve, which is a 256 element array of intensity values in the range [0..1],
where 0 is no application of this color and 1 is full color intensity. The
elements of the array map to image luminance, where element 0 is taken for
pixels with most luminance and element 256 is taken for pixels with no
luminance.
- Since:
- echidna
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of levels supported by instances of this class -
Constructor Summary
ConstructorsConstructorDescriptionColorCurve(ColorCurve colorCurve) Creates a copy of theColorCurveinstance.ColorCurve(Color color) Creates aColorCurvewith the given color and the default mapping.ColorCurve(Color color, float[] curve) Creates aColorCurvewith the given color and an evenly spaced interval table based on list of intensity points.ColorCurve(Color color, float[] curve, float[] intervals) Creates aColorCurvewith the given color and an interval table based on list of intensity points where the interval distances is also specified. -
Method Summary
-
Field Details
-
MAX_LEVEL
public static final int MAX_LEVELThe number of levels supported by instances of this class- See Also:
-
-
Constructor Details
-
ColorCurve
Creates a copy of theColorCurveinstance. This copy constructor copies the values of the other instance. That is external modification of thos values has no influence on the newly created instance.- Parameters:
colorCurve-
-
ColorCurve
Creates aColorCurvewith the given color and the default mapping. The default mapping maps luminosity levels to the same intensity levels.- Parameters:
color- The color to set in thisColorCurve.
-
ColorCurve
Creates aColorCurvewith the given color and an evenly spaced interval table based on list of intensity points.Each entry of the curve parameter is in the range [0..1] and the length of the array is in the interval [2..256]. If the array has less than two entries it is ignored and the identity mapping is taken, if either an entry value is out of range or the curve array is longer than 256 entries, the result is undefined.
- Parameters:
color- The color described by this descriptorcurve- The intensity perecentages for equally distributed intervals ornullto use the identity map.
-
ColorCurve
Creates aColorCurvewith the given color and an interval table based on list of intensity points where the interval distances is also specified.Each entry of the curve parameter is in the range [0..1] and the length of the array is in the interval [2..256]. If the array has less than two entries it is ignored and the identity mapping is taken, if either an entry value is out of range or the curve array is longer than 256 entries, the result is undefined.
The intervals array must contain the one elements less than the curve array, that is the predicate
curve.length - 1 == intervals.lengthmust betrue. If the intervals array is smaller or bigger than that, it is ignored and the points are evenyl spaced !The sum of entries of the intervals array defines the relative size of each interval. For example if the sum of the entries is 11, the first entry is 1, then the first intervall will take 23 steps, which is 256 * 1/11 because each step is 1/11th of the full range of 256.
- Parameters:
color- The color described by this descriptorcurve- The intensity perecentages for the intervals ornullto use the identity map (in which case the intervals argument is ignored).intervals- Normalized intervalls of curve values ornullto evenly space the itensity levels .
-
-
Method Details
-
getColor
Returns the color associated with this instance.- Returns:
- the color associated with this instance.
-
getLevel
public float getLevel(int step) Returns the intensity level for the given level.- Parameters:
step- The luminosity level for which to return this instances intensity level.- Returns:
- The intensity level of this instance for the given luminosity.
- Throws:
IndexOutOfBoundsException- if step is less than 0 or higher thanMAX_LEVEL.
-