Closed mfansler closed 11 years ago
The setClip
method of the java.awt.Graphics
class accepts either the explicit dimensions of a rectangle or a java.awt.Shape
. Initially I only allowed the Clip
graphic to accept scales..Shape
instances, however, that is extremely limited, since it disallows the inclusion of even basic translates, etc.. For the time being I've made it so setClip
can accept any Graphic
, but unless the object is either a Shape
or a Transform
wrapping a Shape
, the render will default back to merely using the bounding box. In most cases (e.g., Image
, Bitmap
) the bounding box is a good approximation anyway. However, there are edge cases like trying to use a graphic that includes a fill or a stroke which are going to fail.
While this commit is a start, we should explore what options we have for casting Graphic
objects to Shape
's. One thought I had was to add a def shape: Shape
to the Graphic
trait, so that every Graphic is responsible for knowing what Shape
best describes it.
Graphic
trait now includes shape: java.awt.Shape
and this is then used for all clipping.
Relevant documentation to look at in the Java AWT library are: