Class ShadowHighlighter

    • 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 interface Figure
        Overrides:
        getBounds in class BasicHighlighter
        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 class BasicHighlighter
        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 interface VisibleComponent
        Overrides:
        paint in class BasicHighlighter
        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 interface CanvasComponent
        Overrides:
        repaint in class BasicHighlighter