Package diva.util.java2d
Class AbstractPaintedGraphic
- java.lang.Object
-
- 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$
- Author:
- Nick Zamora
-
-
Field Summary
Fields Modifier and Type Field Description java.awt.ShapeshapeThe shape being painted.java.awt.StrokestrokeThe stroke.java.awt.PaintstrokePaintThe stroke paint.
-
Constructor Summary
Constructors Constructor Description AbstractPaintedGraphic()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Rectangle2DgetBounds()Get the bounding box of the shape when stroked.abstract floatgetLineWidth()Get the line width.java.awt.StrokegetStroke()Get the stroke.static java.awt.BasicStrokegetStroke(float floatwidth)Get a new stroke of the given width and with no dashing.static java.awt.BasicStrokegetStroke(int width)Get a new stroke of the given width and with no dashing.abstract booleanhit(java.awt.geom.Rectangle2D r)Test if this shape intersects the given rectangle.abstract voidsetLineWidth(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
-
-
-
-
Method Detail
-
getLineWidth
public abstract float getLineWidth()
Get the line width.- Specified by:
getLineWidthin interfacePaintedGraphic
-
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:
getBoundsin interfacePaintedObject
-
getStroke
public java.awt.Stroke getStroke()
Get the stroke.- Specified by:
getStrokein interfacePaintedGraphic
-
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:
hitin interfacePaintedGraphic
-
setLineWidth
public abstract void setLineWidth(float lineWidth)
Set the line width.- Specified by:
setLineWidthin interfacePaintedGraphic
-
-