|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.image.ColorPath
public class ColorPath
provides a path for deriving gradual colors based on a number.
ColorPathBarRenderer,
Serialized Form| Constructor Summary | |
|---|---|
ColorPath()
|
|
ColorPath(boolean onlyFullColors)
|
|
ColorPath(Map<? extends Number,? extends Color> map)
|
|
ColorPath(Map<? extends Number,? extends Color> map,
boolean onlyFullColors)
|
|
| Method Summary | |
|---|---|
void |
add(Color c,
float n)
|
void |
clear()
|
static Color |
deriveColor(Color color1,
Color color2,
float weight)
derives a color as a mixture of the given two colors. |
void |
exportXML(OutputStream out)
exports the entire object as XML and writes it to the given Writer, so that the object can be reconstructed with importXML(InputSource). |
Color |
getColor(float n)
|
Color |
getColor(Number n)
|
Map<Float,Color> |
getColorMap()
returns an unmodifiable view of the embedded data |
void |
importXML(InputStream source)
The object is fully reinitialized with the XML data contained in the given ImputSource, so that the object has the same state as it had during export. |
boolean |
isOnlyFullColors()
if true, the colors on the path are used as thresholds rather than serving as a basis to merge two colors into a new one |
static Color |
makeTransparent(Color color,
float transparency)
makes a given color transparent based on a percentage |
boolean |
remove(Color c)
removes every occurrence of the given color from the path |
Color |
remove(float n)
|
void |
setAllFrom(ColorPath cp)
copies the properties of the given object and applies them to this instance, so that its behavior in regards to the given object can be matched to the extend that the implementing class supports that behavior. |
void |
setColorMap(Map<? extends Number,Color> map)
|
void |
setOnlyFullColors(boolean onlyFullColors)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ColorPath(boolean onlyFullColors)
public ColorPath()
public ColorPath(Map<? extends Number,? extends Color> map)
public ColorPath(Map<? extends Number,? extends Color> map,
boolean onlyFullColors)
| Method Detail |
|---|
public boolean isOnlyFullColors()
public void setOnlyFullColors(boolean onlyFullColors)
public Map<Float,Color> getColorMap()
public void setColorMap(Map<? extends Number,Color> map)
public void clear()
public void add(Color c,
float n)
public Color remove(float n)
public boolean remove(Color c)
public Color getColor(Number n)
public Color getColor(float n)
public void exportXML(OutputStream out)
throws IOException
XMLSerializableimportXML(InputSource).
The given stream is neither flushed nor closed, so that other data may be
effectively written to the InputSource after the method returned.
exportXML in interface XMLSerializableIOExceptionXMLSerializable.importXML(InputStream)
public void importXML(InputStream source)
throws SAXException,
IOException,
ClassCastException
XMLSerializable
importXML in interface XMLSerializableSAXException
IOException
ClassCastExceptionXMLSerializable.exportXML(OutputStream)
public void setAllFrom(ColorPath cp)
throws NullPointerException,
IllegalArgumentException
Forgeable
setAllFrom in interface Forgeable<ColorPath>cp - the object whose behavior is to be copied to this instance
NullPointerException - if the given object parameter is null
IllegalArgumentException - if the given object contains properties that
for some reason cannot be copied to this instance
public static Color deriveColor(Color color1,
Color color2,
float weight)
color1 - the base colorcolor2 - the alternative colorweight - the percentage (between 0 and 1) to which amount the returned color is to be
nearer to the alternative color.
If weight is 0, color1 is returned; if weight is 1, color2 is returned;
if if weight is .5, the 'middle' of the two colors is returned, and so on.
public static Color makeTransparent(Color color,
float transparency)
color - the color that is to be used as a base for deriving a transparent colortransparency - a number between 0 and 1 where 0 is fully transparent and 1 is fully opaque
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||