|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | PROPERTY | DETAIL: PROPERTY | |||||||
ilog.views.util.java2d.IlvContrastingColor
public class IlvContrastingColor
This class denotes a color that depends on the background. It can take two different colors. When the background is bright, it presents itself as a dark color. When the background is dark, it behaves like a bright color.
Note: This class can only be used in graphic objects and renderers that have explicit support for it. Most graphic objects and renderers in JViews do not support it.
Note: In order to add support for IlvContrastingColor
to a drawing routine with a background filled entirely with a known color,
the following code template can be used:
Color backgroundColor = ...;
Graphics2D g = ...;
Color oldPaint = g.getPaint();
try {
g.setPaint(contrastingColor.chooseColor(backgroundColor);
...
} finally {
g.setPaint(oldPaint);
}
Note: In order to add support for IlvContrastingColor
to a drawing routine with an unknown background, the following code template
can be used:
Color backgroundColor = ...;
Graphics2D g = ...;
Color oldPaint = g.getPaint();
Composite oldComposite = g.getComposite();
try {
g.setPaint(Color.black);
g.setComposite(contrastingColor);
...
} finally {
g.setPaint(oldPaint);
g.setComposite(oldComposite);
}
Note: IlvContrastingColor is a custom implementation of
Composite. Due to Sun JRE bug #4833528, custom
Composites work only when rendering into a
BufferedImage. This is the case
sun.java2d.pmoffscreen is set to false,
orBufferedImage.
ilvContrastingColor {
class : "ilog.views.util.java2d.IlvContrastingColor(darkColor,brightColor,threshold)";
brightColor : "green";
darkColor : "green";
threshold : "2.0";
}
| Property Summary | |
|---|---|
java.awt.Color |
brightColor
Sets the color used in front of dark background. |
java.lang.String |
class
Creates a contrasting color with the given dark and bright color. |
java.awt.Color |
darkColor
Sets the color used in front of bright background. |
float |
threshold
Sets the brightness limit used to distinguish whether the background is considered as bright or dark. |
| Property Detail |
|---|
public java.lang.String class
class : "ilog.views.util.java2d.IlvContrastingColor(darkColor,brightColor,threshold)";
public java.awt.Color brightColor
brightColor : "green";
public java.awt.Color darkColor
darkColor : "green";
public float threshold
threshold : "2.0";
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | PROPERTY | DETAIL: PROPERTY | |||||||