Package com.luciad.gui
Class TLcdHaloIcon
java.lang.Object
com.luciad.gui.TLcdHaloIcon
- All Implemented Interfaces:
ILcdAnchoredIcon
,ILcdIcon
,ILcdCloneable
,Serializable
,Cloneable
Wrapper for an
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.- Since:
- 9.0
- See Also:
-
Constructor Summary
ConstructorDescriptionTLcdHaloIcon
(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 newTLcdHaloIcon
wrapping the given icon, configured with the given halo color and thickness.. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Clears the image cache.clone()
MakesObject.clone()
public.boolean
Returns the algorithm that is used for rendering halo's.Returns the color of the halo effect.int
Returns the thickness of the halo effect.getIcon()
Returns the icon to draw a halo for.int
Returns the fixed height of the icon.int
Returns the fixed width of the icon.int
hashCode()
boolean
Returns whether the icon will add a halo effect around the wrapped icon.boolean
Returns whether the icon image caching is enabled or not.void
Draw theILcdIcon
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
Sets the icon draw a halo for.void
setUseImageCache
(boolean aUseImageCache) Turns caching of the icons as images on or off.toString()
-
Constructor Details
-
TLcdHaloIcon
Creates a new halo icon with the default settings: a one pixel white halo.- Parameters:
aIcon
- The icon to add halo to.
-
TLcdHaloIcon
Creates a newTLcdHaloIcon
wrapping the given icon, configured with the given halo color and thickness..- Parameters:
aIcon
- theILcdIcon
to add halo to.aHaloColor
- the halo coloraHaloThickness
- the halo thickness
-
-
Method Details
-
paintIcon
Description copied from interface:ILcdIcon
Draw theILcdIcon
at the specified location.ILcdIcon
implementations may use theComponent
argument to get properties useful for painting, e.g. the foreground or background color.- Specified by:
paintIcon
in interfaceILcdIcon
- Parameters:
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.
-
getIconWidth
public int getIconWidth()Description copied from interface:ILcdIcon
Returns the fixed width of the icon.- Specified by:
getIconWidth
in interfaceILcdIcon
- Returns:
- the fixed width of the icon.
-
getIconHeight
public int getIconHeight()Description copied from interface:ILcdIcon
Returns the fixed height of the icon.- Specified by:
getIconHeight
in interfaceILcdIcon
- Returns:
- the fixed height of the icon.
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.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 ); } }
- Specified by:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classObject
- See Also:
-
getIcon
Returns the icon to draw a halo for.- Returns:
- the new icon
- Since:
- 2018.1
-
setIcon
Sets the icon draw a halo for.- Parameters:
aIcon
- the new icon- Since:
- 2018.1
-
isHaloEnabled
public boolean isHaloEnabled()Returns whether the icon will add a halo effect around the wrapped icon.- Returns:
- whether the icon will add a halo effect around the wrapped icon.
- See Also:
-
setHaloEnabled
public void setHaloEnabled(boolean aHaloEnabled) Determines whether the icon will add a halo effect around the wrapped icon. By default, this property is set totrue
.- Parameters:
aHaloEnabled
- a flag indicating whether to add a halo effect around the icons.- See Also:
-
getHaloThickness
public int getHaloThickness()Returns the thickness of the halo effect.- Returns:
- the thickness of the halo effect.
- See Also:
-
setHaloThickness
public void setHaloThickness(int aHaloThickness) Sets the thickness defined in pixels of the halo effect. By default, this property is set to1
.- Parameters:
aHaloThickness
- the thickness defined in pixels of the halo effect.- See Also:
-
getHaloColor
Returns the color of the halo effect.- Returns:
- the color of the halo effect.
- See Also:
-
setHaloColor
Sets the color of the halo effect. By default, this property is set toColor.white
.- Parameters:
aHaloColor
- the color of the halo effect.- See Also:
-
setHaloAlgorithm
Sets the algorithm to be used for rendering halo's. The choice of the halo algorithm may have a major impact on the overall performance of this painter. SeeTLcdHaloAlgorithm
for more information on the available algorithms.- Parameters:
aHaloAlgorithm
- the algorithm to be used for rendering halo's.- See Also:
-
getHaloAlgorithm
Returns the algorithm that is used for rendering halo's.- Returns:
- the algorithm that is used for rendering halo's.
- See Also:
-
isUseImageCache
public boolean isUseImageCache()Returns whether the icon image caching is enabled or not.- Returns:
- whether the icon image caching is enabled or not.
- See Also:
-
setUseImageCache
public void setUseImageCache(boolean aUseImageCache) Turns caching of the icons as images on or off. By default, image caching is turned on.- Parameters:
aUseImageCache
- a flag indicating whether image caching should be enabled.- See Also:
-
clearImageCache
public void clearImageCache()Clears the image cache.
- See Also:
-
toString
-
equals
-
hashCode
public int hashCode() -
anchorPointSFCT
Description copied from interface:ILcdAnchoredIcon
Updates the given point to the location of the icon's anchor point, in relative coordinates with respect to the top left. The x-coordinate of the anchor point typically lies between 0 and getWidth(). The y-coordinate typically lies between 0 and getHeight().- Specified by:
anchorPointSFCT
in interfaceILcdAnchoredIcon
- Parameters:
aPointSFCT
- the point that has to be moved to the location of the anchor point of this icon.
-