public class ColorGradient
extends java.lang.Object
Constructor and Description |
---|
ColorGradient()
Creates a default color gradient object having the color black at position 0 and white at position 1.
|
Modifier and Type | Method and Description |
---|---|
void |
addColorPoint(java.awt.Color pColor,
double dPosition)
Adds a color point with a specified color and position.
|
java.awt.Color |
getColorAtPosition(double dPosition)
Returns the color at the specified position.
|
java.awt.Color |
getColorOfColorPoint(int iColorPointId)
Returns the color of the specified color point.
|
int |
getColorPointNum()
Returns the current number of color points.
|
int |
getIdOfColorPointWithColor(java.awt.Color pColor)
Returns the id of the first color point having the specified color.
|
double |
getPositionOfColorPoint(int iColorPointId)
Returns the position of the specified color point.
|
int |
getRGBAtPosition(double dPosition)
Returns the color at the specified position.
|
int[] |
getRGBLookupTable(int iEntryNum)
Returns a color lookup table with the specified number of entries,
where the entry 0 represents the color at position 0 and the n-th entry
represents the color at position 1.
|
void |
removeColorPoint(int iColorPointId)
Removes the specified color point.
|
void |
setColorOfColorPoint(int iColorPointId,
java.awt.Color pColor)
Sets the color of the specified color point.
|
void |
setPositionOfColorPoint(int iColorPointId,
double dPosition)
Sets the position of the specified color point.
|
public ColorGradient()
public void setPositionOfColorPoint(int iColorPointId, double dPosition)
iColorPointId
- The id of the color point as integer.dPosition
- The new position of the color point as double between 0 and 1.
If the position is outside this interval it is mapped to the nearest interval limit.public void setColorOfColorPoint(int iColorPointId, java.awt.Color pColor)
iColorPointId
- The id of the color point as integer.pColor
- The new color of the color point.public void removeColorPoint(int iColorPointId)
iColorPointId
- The id of the color point as integer.public void addColorPoint(java.awt.Color pColor, double dPosition)
pColor
- The new color of the color point.dPosition
- The new position of the color point as double between 0 and 1.
If the position is outside this interval it is mapped to the nearest interval limit.public int getIdOfColorPointWithColor(java.awt.Color pColor)
pColor
- The color of the color point that should be found.public int getColorPointNum()
public double getPositionOfColorPoint(int iColorPointId)
iColorPointId
- The id of the color point as integer.public java.awt.Color getColorOfColorPoint(int iColorPointId)
iColorPointId
- The id of the color point as integer.public java.awt.Color getColorAtPosition(double dPosition)
dPosition
- The position as double betweent 0 and 1.public int getRGBAtPosition(double dPosition)
dPosition
- The position as double betweent 0 and 1.public int[] getRGBLookupTable(int iEntryNum)
iEntryNum
- The number of entries that the color lookup table should have.