Package diva.canvas
Class DamageRegion
- java.lang.Object
-
- diva.canvas.DamageRegion
-
public abstract class DamageRegion extends java.lang.ObjectA damage region represents a region of the canvas that has been "damaged" and hence needs to be repainted. Damage regions are passed up from a component that creates the damage until they reach the JCanvas, at which point the Swing RepaintManager gets called.- Version:
- $Id$
- Author:
- John Reekie
- Pt.AcceptedRating:
- Red
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidapply(JCanvas canvas)Tell the damage region to inflict itself on the given JCanvas.voidcheckCacheValid(TransformContext c)Check transform cache validity.static DamageRegioncreateDamageRegion(TransformContext c, double x, double y, double w, double h)Create a damage region in this context over the given rectangle.static DamageRegioncreateDamageRegion(TransformContext c, java.awt.geom.Rectangle2D r)Create a damage region in this context over the given rectangle.abstract voidextend(java.awt.geom.Rectangle2D r)Extend the damage region with the given rectangle.abstract java.awt.geom.Rectangle2DgetBounds()Get the bounds of this damage region.TransformContextgetContext()Get the transform context in which this damage region was created.
-
-
-
Method Detail
-
apply
public abstract void apply(JCanvas canvas)
Tell the damage region to inflict itself on the given JCanvas.- Parameters:
canvas- The canvas
-
checkCacheValid
public void checkCacheValid(TransformContext c)
Check transform cache validity. This must be called from the repaint(DamageRegion) method of any component that has a transform context.- Parameters:
c- The TransformContext
-
createDamageRegion
public static DamageRegion createDamageRegion(TransformContext c, java.awt.geom.Rectangle2D r)
Create a damage region in this context over the given rectangle.- Parameters:
c- The Transform Contextr- The given rectangle- Returns:
- The Damage Region.
-
createDamageRegion
public static DamageRegion createDamageRegion(TransformContext c, double x, double y, double w, double h)
Create a damage region in this context over the given rectangle.- Parameters:
c- The Transform Contextx- The x location of a corner of the damage regiony- The y location of a corner of the damage regionw- The width of the damage regionh- The height of the damage region- Returns:
- The Damage Region.
-
extend
public abstract void extend(java.awt.geom.Rectangle2D r)
Extend the damage region with the given rectangle.- Parameters:
r- The rectangle to which to extend to.
-
getBounds
public abstract java.awt.geom.Rectangle2D getBounds()
Get the bounds of this damage region.- Returns:
- The bounds of the damage region.
-
getContext
public TransformContext getContext()
Get the transform context in which this damage region was created.- Returns:
- The transformContext.
-
-