Package ptolemy.vergil.kernel
Class ShadowHighlighter
- java.lang.Object
-
- diva.canvas.AbstractFigure
-
- diva.canvas.AbstractFigureContainer
-
- diva.canvas.FigureDecorator
-
- diva.canvas.toolbox.BasicHighlighter
-
- ptolemy.vergil.kernel.ShadowHighlighter
-
- All Implemented Interfaces:
CanvasComponent
,Figure
,FigureContainer
,FigureSet
,VisibleComponent
,UserObjectContainer
public class ShadowHighlighter extends BasicHighlighter
A decorator figure that displays a shadow behind the figure. The highlighter has several options to control the color, transparency, and size. Currently, this- Since:
- Ptolemy II 10.0
- Version:
- $Id$, $Id$
- Author:
- Edward A. Lee
-
-
Constructor Summary
Constructors Constructor Description ShadowHighlighter()
Create a new shadow with a default paint and size.ShadowHighlighter(java.awt.Paint paint, float halo)
Create a new shadow with the given paint and halo.ShadowHighlighter(java.awt.Paint paint, float halo, java.awt.Composite composite)
Create a new shadow with the given paint, size.ShadowHighlighter(java.awt.Paint paint, float halo, java.awt.Composite composite, java.awt.Stroke stroke)
Create a new shadow with the given paint, size, compositing operation, and stroke.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Rectangle2D
getBounds()
Get the bounds.FigureDecorator
newInstance(Figure figure)
Create a new instance of this shadower.void
paint(java.awt.Graphics2D g)
Paint the figure.void
repaint()
Request a repaint of the figure and shadow.-
Methods inherited from class diva.canvas.toolbox.BasicHighlighter
getComposite, getHalo, getPaint, getStroke, hit, repaint
-
Methods inherited from class diva.canvas.FigureDecorator
add, contains, figures, figuresFromBack, figuresFromFront, getChild, getContainer, getDecoratedFigure, getFigureCount, getShape, remove, replaceChild, setChild, transform, translate
-
Methods inherited from class diva.canvas.AbstractFigureContainer
decorate, pick, pick, undecorate
-
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, setInteractor, setParent, setToolTipText, setUserObject, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface diva.canvas.CanvasComponent
getTransformContext
-
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, paint, setVisible
-
-
-
-
Constructor Detail
-
ShadowHighlighter
public ShadowHighlighter()
Create a new shadow with a default paint and size.
-
ShadowHighlighter
public ShadowHighlighter(java.awt.Paint paint, float halo)
Create a new shadow with the given paint and halo.- Parameters:
paint
- The paint.halo
- The halo, which is the size of the shadow.
-
ShadowHighlighter
public ShadowHighlighter(java.awt.Paint paint, float halo, java.awt.Composite composite)
Create a new shadow with the given paint, size. and compositing operation.- Parameters:
paint
- The paint.halo
- The halo, which is the size of the shadow.composite
- The compositing operation.
-
ShadowHighlighter
public ShadowHighlighter(java.awt.Paint paint, float halo, java.awt.Composite composite, java.awt.Stroke stroke)
Create a new shadow with the given paint, size, compositing operation, and stroke. This shadow draws an outline only and does not fill it.- Parameters:
paint
- The paint.halo
- The halo, which is the size of the shadow.composite
- The compositing operation.stroke
- The stroke
-
-
Method Detail
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
Get the bounds. This is the child's bounding box stretched by the "halo."- Specified by:
getBounds
in interfaceFigure
- Overrides:
getBounds
in classBasicHighlighter
- Returns:
- The bounds.
-
newInstance
public FigureDecorator newInstance(Figure figure)
Create a new instance of this shadower. The new instance will have the same paint, size, and composite as this one.- Overrides:
newInstance
in classBasicHighlighter
- Parameters:
figure
- The figure, ignored in this method.- Returns:
- A new instance of the ShadowHighlighter class.
-
paint
public void paint(java.awt.Graphics2D g)
Paint the figure. This method first paints the shadow over the contained figure's bounding box stretched by the size. It then paints the contained figure.- Specified by:
paint
in interfaceVisibleComponent
- Overrides:
paint
in classBasicHighlighter
- Parameters:
g
- The Graphics2D context.
-
repaint
public void repaint()
Request a repaint of the figure and shadow. This method reads the bounding box of the shadowed figure, and requests a repaint of that box stretched in each direction by the size.- Specified by:
repaint
in interfaceCanvasComponent
- Overrides:
repaint
in classBasicHighlighter
-
-