diva.util.java2d
Class AbstractPaintedGraphic

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

public abstract class AbstractPaintedGraphic
extends java.lang.Object
implements PaintedGraphic

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

Version:
$Id: AbstractPaintedGraphic.java 41477 2006-03-29 00:03:58Z cxh $
Author:
Nick Zamora

Field Summary
private static java.awt.BasicStroke[] _strokes
          A static array of cached strokes
 java.awt.Shape shape
          The shape being painted.
 java.awt.Stroke stroke
          The stroke.
 java.awt.Paint strokePaint
          The stroke paint.
 
Constructor Summary
AbstractPaintedGraphic()
           
 
Method Summary
 java.awt.geom.Rectangle2D getBounds()
          Get the bounding box of the shape when stroked.
abstract  float getLineWidth()
          Get the line width.
 java.awt.Stroke getStroke()
          Get the stroke.
static java.awt.BasicStroke getStroke(float floatwidth)
          Get a new stroke of the given width and with no dashing.
static java.awt.BasicStroke getStroke(int width)
          Get a new stroke of the given width and with no dashing.
abstract  boolean hit(java.awt.geom.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.util.java2d.PaintedGraphic
intersects
 
Methods inherited from interface diva.util.java2d.PaintedObject
paint
 

Field Detail

stroke

public java.awt.Stroke stroke
The stroke.


shape

public java.awt.Shape shape
The shape being painted.


strokePaint

public java.awt.Paint strokePaint
The stroke paint.


_strokes

private static java.awt.BasicStroke[] _strokes
A static array of cached strokes

Constructor Detail

AbstractPaintedGraphic

public AbstractPaintedGraphic()
Method Detail

getLineWidth

public abstract float getLineWidth()
Get the line width.

Specified by:
getLineWidth in interface PaintedGraphic

getBounds

public java.awt.geom.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 java.awt.Stroke getStroke()
Get the stroke.

Specified by:
getStroke in interface PaintedGraphic

getStroke

public static java.awt.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 java.awt.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(java.awt.geom.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