public class TLcdHaloIcon extends Object implements ILcdAnchoredIcon, Cloneable
ILcdIcon
that adds halo effects when painting it.
For a more detailed explanation of halos, please refer to TLcdGXYHaloLabelPainter
.
This icon uses the Decorator design pattern to add halo support to any
existing ILcdIcon
implementation. The methods that
control the appearance of the halos are equivalent to those in
TLcdGXYHaloLabelPainter
.
When the wrapped icon can change dynamically, for example when using
TLcdRotatingIcon
, the image caching must be disabled (see
setUseImageCache(boolean)
), or the image cache must be cleared whenever the delegate
icon changed.Constructor and Description |
---|
TLcdHaloIcon(ILcdIcon aIcon)
Creates a new halo icon with the default settings: a one pixel white halo.
|
TLcdHaloIcon(ILcdIcon aIcon,
Color aHaloColor,
int aHaloThickness)
Creates a new
TLcdHaloIcon wrapping the given icon, configured
with the given halo color and thickness.. |
Modifier and Type | Method and Description |
---|---|
void |
anchorPointSFCT(Point aPointSFCT)
Updates the given point to the location of the icon's anchor point, in relative coordinates with respect to the top left.
|
void |
clearImageCache()
Clears the image cache.
|
Object |
clone()
Makes
Object.clone() public. |
boolean |
equals(Object o) |
TLcdHaloAlgorithm |
getHaloAlgorithm()
Returns the algorithm that is used for rendering halo's.
|
Color |
getHaloColor()
Returns the color of the halo effect.
|
int |
getHaloThickness()
Returns the thickness of the halo effect.
|
ILcdIcon |
getIcon()
Returns the icon to draw a halo for.
|
int |
getIconHeight()
Returns the fixed height of the icon.
|
int |
getIconWidth()
Returns the fixed width of the icon.
|
int |
hashCode() |
boolean |
isHaloEnabled()
Returns whether the icon will add a halo effect around the wrapped icon.
|
boolean |
isUseImageCache()
Returns whether the icon image caching is enabled or not.
|
void |
paintIcon(Component c,
Graphics g,
int x,
int y)
Draw the
ILcdIcon at the specified location. |
void |
setHaloAlgorithm(TLcdHaloAlgorithm aHaloAlgorithm)
Sets the algorithm to be used for rendering halo's.
|
void |
setHaloColor(Color aHaloColor)
Sets the color of the halo effect.
|
void |
setHaloEnabled(boolean aHaloEnabled)
Determines whether the icon will add a halo effect around the wrapped icon.
|
void |
setHaloThickness(int aHaloThickness)
Sets the thickness defined in pixels of the halo effect.
|
void |
setIcon(ILcdIcon aIcon)
Sets the icon draw a halo for.
|
void |
setUseImageCache(boolean aUseImageCache)
Turns caching of the icons as images on or off.
|
String |
toString() |
public TLcdHaloIcon(ILcdIcon aIcon)
aIcon
- The icon to add halo to.public TLcdHaloIcon(ILcdIcon aIcon, Color aHaloColor, int aHaloThickness)
TLcdHaloIcon
wrapping the given icon, configured
with the given halo color and thickness..aIcon
- the ILcdIcon
to add halo to.aHaloColor
- the halo coloraHaloThickness
- the halo thicknesspublic void paintIcon(Component c, Graphics g, int x, int y)
ILcdIcon
ILcdIcon
at the specified location. ILcdIcon
implementations
may use the Component
argument to get properties useful for
painting, e.g. the foreground or background color.paintIcon
in interface ILcdIcon
c
- a Component to retrieve properties from.g
- the Graphics on which the icon will be painted.x
- the x position where the icon will be painted. x is the first coordinate of the top left
corner point of the icon.y
- the y position where the icon will be painted. y is the second coordinate of the top left
corner point of the icon.public int getIconWidth()
ILcdIcon
getIconWidth
in interface ILcdIcon
public int getIconHeight()
ILcdIcon
getIconHeight
in interface ILcdIcon
public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()
public ILcdIcon getIcon()
public void setIcon(ILcdIcon aIcon)
aIcon
- the new iconpublic boolean isHaloEnabled()
setHaloEnabled(boolean)
public void setHaloEnabled(boolean aHaloEnabled)
true
.aHaloEnabled
- a flag indicating whether to add a halo effect around the icons.isHaloEnabled()
public int getHaloThickness()
setHaloThickness(int)
public void setHaloThickness(int aHaloThickness)
1
.aHaloThickness
- the thickness defined in pixels of the halo effect.getHaloThickness()
,
TLcdGXYHaloLabelPainter.setHaloThickness(int)
public Color getHaloColor()
setHaloColor(java.awt.Color)
public void setHaloColor(Color aHaloColor)
Color.white
.aHaloColor
- the color of the halo effect.getHaloColor()
,
TLcdGXYHaloLabelPainter.setHaloColor(java.awt.Color)
public void setHaloAlgorithm(TLcdHaloAlgorithm aHaloAlgorithm)
TLcdHaloAlgorithm
for more information on the available algorithms.aHaloAlgorithm
- the algorithm to be used for rendering halo's.TLcdHaloAlgorithm
,
getHaloAlgorithm()
public TLcdHaloAlgorithm getHaloAlgorithm()
TLcdHaloAlgorithm
,
setHaloAlgorithm(com.luciad.util.TLcdHaloAlgorithm)
public boolean isUseImageCache()
setUseImageCache(boolean)
public void setUseImageCache(boolean aUseImageCache)
aUseImageCache
- a flag indicating whether image caching should be enabled.isUseImageCache()
,
TLcdGXYHaloLabelPainter.setUseImageCache(boolean)
public void clearImageCache()
Clears the image cache.
setUseImageCache(boolean)
public void anchorPointSFCT(Point aPointSFCT)
ILcdAnchoredIcon
anchorPointSFCT
in interface ILcdAnchoredIcon
aPointSFCT
- the point that has to be moved to the location of the anchor point
of this icon.