values].
While continuous objects will probably center themselves on the origin,
Discrete 2D objects typically will draw themselves to fill the box (the
box effectively defines the [0,0] to [1,1] range). You may assume that
the coordinates will never be fipped or zeroed (that is, the width and
height will not be negative or 0).
Why is this rectangle being provided instead of just using an affine transform
on the grahics object to scale and translate the space? Two reasons. First,
affine transforms are expensive in Java2D. Second, if you need to draw auxillary
information (like readable text), the text would also get transformed (scaled), which
is not what we want. Line thickness is also likewise transformed, which might or
might not be desirable.
The clip rectangle describes a box defining a region that must be drawn.
This region will always intersect at least partially with the draw rectangle.
Why provide this clip rectangle? Because to my knowledge there's no standard way to
tell objects that only part of them needs to be updated in Java2D and Swing -- a failure
of the system design.
Field Summary |
java.awt.geom.Rectangle2D.Double |
clip
|
java.awt.geom.Rectangle2D.Double |
draw
|
Constructor Summary |
DrawInfo2D(java.awt.geom.Rectangle2D.Double draw,
java.awt.geom.Rectangle2D.Double clip)
|
DrawInfo2D(java.awt.Rectangle draw,
java.awt.Rectangle clip)
|
DrawInfo2D(java.awt.geom.RectangularShape draw,
java.awt.geom.RectangularShape clip)
|
Method Summary |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
draw
public java.awt.geom.Rectangle2D.Double draw
clip
public java.awt.geom.Rectangle2D.Double clip
DrawInfo2D
public DrawInfo2D(java.awt.geom.Rectangle2D.Double draw,
java.awt.geom.Rectangle2D.Double clip)
DrawInfo2D
public DrawInfo2D(java.awt.Rectangle draw,
java.awt.Rectangle clip)
DrawInfo2D
public DrawInfo2D(java.awt.geom.RectangularShape draw,
java.awt.geom.RectangularShape clip)
toString
public java.lang.String toString()