diva.compat.canvas
Class AbstractPaintedGraphic

java.lang.Object
  extended by diva.compat.canvas.AbstractPaintedGraphic
All Implemented Interfaces:
PaintedGraphic, PaintedObject
Direct Known Subclasses:
PaintedPath, PaintedShape

public abstract class AbstractPaintedGraphic
extends Object
implements PaintedGraphic

An abstract implementation of the PaintedGraphic interface. This class implements the common elements of the PaintedGraphic abstraction.

Version:
$Revision: 1.2 $
Author:
Nick Zamora

Field Summary
 Shape shape
          The shape being painted.
 Stroke stroke
          The stroke.
 Paint strokePaint
          The stroke paint.
 
Constructor Summary
AbstractPaintedGraphic()
           
 
Method Summary
 Rectangle2D getBounds()
          Get the bounding box of the shape when stroked.
abstract  float getLineWidth()
          Get the line width.
 Stroke getStroke()
          Get the stroke.
static BasicStroke getStroke(float floatwidth)
          Get a new stroke of the given width and with no dashing.
static BasicStroke getStroke(int width)
          Get a new stroke of the given width and with no dashing.
abstract  boolean hit(Rectangle2D r)
          Test if this shape intersects the given rectangle.
abstract  void setLineWidth(float lineWidth)
          Set the line width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface diva.compat.canvas.PaintedGraphic
intersects
 
Methods inherited from interface diva.compat.canvas.PaintedObject
paint
 

Field Detail

stroke

public Stroke stroke
The stroke.


shape

public Shape shape
The shape being painted.


strokePaint

public Paint strokePaint
The stroke paint.

Constructor Detail

AbstractPaintedGraphic

public AbstractPaintedGraphic()
Method Detail

getLineWidth

public abstract float getLineWidth()
Get the line width.

Specified by:
getLineWidth in interface PaintedGraphic

getBounds

public Rectangle2D getBounds()
Get the bounding box of the shape when stroked. This method takes account of the thickness of the stroke.

Specified by:
getBounds in interface PaintedObject

getStroke

public Stroke getStroke()
Get the stroke.

Specified by:
getStroke in interface PaintedGraphic

getStroke

public static BasicStroke getStroke(int width)
Get a new stroke of the given width and with no dashing. This method will generally return an existing stroke object, and can be used to save creating zillions of Stroke objects.


getStroke

public static BasicStroke getStroke(float floatwidth)
Get a new stroke of the given width and with no dashing. This method will return an existing stroke object if the width is integer-valued and has a reasonably small width. This method can be used to save creating zillions of Stroke objects.


hit

public abstract boolean hit(Rectangle2D r)
Test if this shape intersects the given rectangle. Currently this does not take into account the width of the stroke or other things such as dashes, because of problems with geometry testing with GeneralPath in the first version of JDK1.2.

Specified by:
hit in interface PaintedGraphic

setLineWidth

public abstract void setLineWidth(float lineWidth)
Set the line width.

Specified by:
setLineWidth in interface PaintedGraphic


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.