public class GradationCurve extends NaturalCubicSpline1D implements Cloneable
NaturalCubicSpline1D
, the GradationCurve is
defined by a set of control points which may be set, removed and modified.
However, the control points are subject to certain restrictions which are due
to the nature of a GradationCurve:
curveChanged, points
Constructor and Description |
---|
GradationCurve()
Create a new GradationCurve which is initialised as a linear identity
curve.
|
GradationCurve(GradationCurve gradCurve)
Create a new GradationCurve as clone of a given gradation curve.
|
Modifier and Type | Method and Description |
---|---|
int |
addControlPoint(Point p)
Add a control point to the end of the list.
|
protected GradationCurve |
clone() |
protected void |
computeCurve() |
boolean |
equals(Object obj) |
Point |
getControlPoint(int n)
Get a specified control point.
|
byte[] |
getLookupTable(int size)
Return a lookup table based on the curve in the range 0...size.
|
int |
getValueAt(int x)
Get the intensity value for a given point.
|
int |
hashCode()
Calculate a hash code based on all points on the curve.
|
int |
insertControlPoint(int n,
Point p)
Insert a control point at a given location
|
boolean |
isLinearIdentity()
Returns whether this curve is a identity curve
|
void |
load(Properties properties,
String curveName)
Load the curve from the given properties object.
|
void |
removeControlPoint(int n)
Remove the specified control point
|
void |
reset()
Removes all intermediate controls points and keeps just a start and end
point for this curve.
|
void |
save(Properties properties,
String curveName)
Save the curve into the given properties object.
|
void |
setControlPoint(int n,
Point p)
Set the specified control point
|
String |
toString() |
getCurve, getValueAt
getControlPoints, getPointCount
public GradationCurve()
public GradationCurve(GradationCurve gradCurve)
public int addControlPoint(Point p)
ControlCurve
addControlPoint
in class ControlCurve
p
- the Point
to addThe addition
makes sure that the x values of the points are ascending.
public Point getControlPoint(int n)
ControlCurve
getControlPoint
in class ControlCurve
ControlCurve.getControlPoint(int)
public int insertControlPoint(int n, Point p)
ControlCurve
insertControlPoint
in class ControlCurve
n
- the position to insert atp
- the Point
to insertThe
insertion makes sure that the x values of the points are ascending, if
necessary, the x value is modified.
public void removeControlPoint(int n)
ControlCurve
removeControlPoint
in class ControlCurve
n
- the index of the point to removeControlCurve.removeControlPoint(int)
public void reset()
public void setControlPoint(int n, Point p)
ControlCurve
setControlPoint
in class ControlCurve
n
- the index of the point to modifyp
- the Point
to setThe modification
makes sure that the x values of the points are ascending, if necessary, the x value is
modified.
public void load(Properties properties, String curveName)
[curveName.]point.i.x
and [curveName.]point.i.y
with curveName
being the supplied curve name and
i
being an index from 0 to n-1.properties
- the Properties
from which to load the curvecurveName
- the optional name of the curve. If non- null
,
the name is prepended to the keys with a separating dot.public void save(Properties properties, String curveName)
[curveName.]point.i.x
and [curveName.]point.i.y
with curveName
being the supplied curve name and
i
being an index from 0 to n-1.properties
- the Properties
from which to load the curvecurveName
- the optional name of the curve. If non- null
,
the name is prepended to the keys with a separating dot.public int getValueAt(int x)
protected GradationCurve clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public boolean equals(Object obj)
equals
in class Object
Object.equals(Object)
public boolean isLinearIdentity()
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
Object.toString()
public byte[] getLookupTable(int size)
protected void computeCurve()
computeCurve
in class NaturalCubicSpline1D
Copyright © 2024 levigo holding gmbh. All rights reserved.