Class TLcdHaloIcon

java.lang.Object
com.luciad.gui.TLcdHaloIcon
All Implemented Interfaces:
ILcdAnchoredIcon, ILcdIcon, ILcdCloneable, Serializable, Cloneable

public class TLcdHaloIcon extends Object implements ILcdAnchoredIcon, 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 Details

    • TLcdHaloIcon

      public TLcdHaloIcon(ILcdIcon aIcon)
      Creates a new halo icon with the default settings: a one pixel white halo.
      Parameters:
      aIcon - The icon to add halo to.
    • TLcdHaloIcon

      public TLcdHaloIcon(ILcdIcon aIcon, Color aHaloColor, int aHaloThickness)
      Creates a new TLcdHaloIcon wrapping the given icon, configured with the given halo color and thickness..
      Parameters:
      aIcon - the ILcdIcon to add halo to.
      aHaloColor - the halo color
      aHaloThickness - the halo thickness
  • Method Details

    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Description copied from interface: ILcdIcon
      Draw the 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.
      Specified by:
      paintIcon in interface ILcdIcon
      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 interface ILcdIcon
      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 interface ILcdIcon
      Returns:
      the fixed height of the icon.
    • clone

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from 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 interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also:
    • getIcon

      public ILcdIcon getIcon()
      Returns the icon to draw a halo for.
      Returns:
      the new icon
      Since:
      2018.1
    • setIcon

      public void setIcon(ILcdIcon aIcon)
      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 to true.
      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 to 1.
      Parameters:
      aHaloThickness - the thickness defined in pixels of the halo effect.
      See Also:
    • getHaloColor

      public Color getHaloColor()
      Returns the color of the halo effect.
      Returns:
      the color of the halo effect.
      See Also:
    • setHaloColor

      public void setHaloColor(Color aHaloColor)
      Sets the color of the halo effect. By default, this property is set to Color.white.
      Parameters:
      aHaloColor - the color of the halo effect.
      See Also:
    • setHaloAlgorithm

      public void setHaloAlgorithm(TLcdHaloAlgorithm aHaloAlgorithm)
      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. See TLcdHaloAlgorithm for more information on the available algorithms.
      Parameters:
      aHaloAlgorithm - the algorithm to be used for rendering halo's.
      See Also:
    • getHaloAlgorithm

      public TLcdHaloAlgorithm 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

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • anchorPointSFCT

      public void anchorPointSFCT(Point aPointSFCT)
      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 interface ILcdAnchoredIcon
      Parameters:
      aPointSFCT - the point that has to be moved to the location of the anchor point of this icon.