diva.canvas
Class DamageRegion

java.lang.Object
  extended by diva.canvas.DamageRegion
Direct Known Subclasses:
DamageRegion.RectangleDamageRegion

public abstract class DamageRegion
extends java.lang.Object

A 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: DamageRegion.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie
Accepted Rating:
Red

Nested Class Summary
private static class DamageRegion.RectangleDamageRegion
          A rectangular damage region.
 
Field Summary
(package private)  TransformContext _context
           
 
Constructor Summary
DamageRegion()
          FIXME: Visual Cafe barfs on this private
 
Method Summary
abstract  void apply(JCanvas canvas)
          Tell the damage region to inflict itself on the given JCanvas.
 void checkCacheValid(TransformContext c)
          Check transform cache validity.
static DamageRegion createDamageRegion(TransformContext c, double x, double y, double w, double h)
          Create a damage region in this context over the given rectangle.
static DamageRegion createDamageRegion(TransformContext c, java.awt.geom.Rectangle2D r)
          Create a damage region in this context over the given rectangle.
abstract  void extend(java.awt.geom.Rectangle2D r)
          Extend the damage region with the given rectangle.
abstract  java.awt.geom.Rectangle2D getBounds()
          Get the bounds of this damage region.
 TransformContext getContext()
          Get the transform context in which this damage region was created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_context

TransformContext _context
Constructor Detail

DamageRegion

DamageRegion()
FIXME: Visual Cafe barfs on this private

Method Detail

apply

public abstract void apply(JCanvas canvas)
Tell the damage region to inflict itself on the given JCanvas.


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.


createDamageRegion

public static DamageRegion createDamageRegion(TransformContext c,
                                              java.awt.geom.Rectangle2D r)
Create a damage region in this context over the given rectangle.


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.


extend

public abstract void extend(java.awt.geom.Rectangle2D r)
Extend the damage region with the given rectangle.


getBounds

public abstract java.awt.geom.Rectangle2D getBounds()
Get the bounds of this damage region.


getContext

public TransformContext getContext()
Get the transform context in which this damage region was created.