FileDocCategorySizeDatePackage
Area.javaAPI DocAndroid 1.5 API10278Wed May 06 22:41:54 BST 2009java.awt.geom

Area

public class Area extends Object implements Shape, Cloneable
The Class Area provides a minimal implementation for a generic shape.
since
Android 1.0

Fields Summary
Shape
s
The source Shape object.
Constructors Summary
public Area()
Instantiates a new area with no data.

    
public Area(Shape s)
Instantiates a new area with data given by the specified shape.

param
s the shape that gives the data for this Area.

        if (s == null) {
            throw new NullPointerException();
        }
        this.s = s;
    
Methods Summary
public voidadd(java.awt.geom.Area area)
Adds the specified area to this area.

param
area the area to add to this area.
throws
NotImplementedException if this method is not implemented.

        throw new RuntimeException("Not implemented"); //$NON-NLS-1$
    
public java.lang.Objectclone()

        return new Area(this);
    
public booleancontains(double x, double y)

        return s == null ? false : s.contains(x, y);
    
public booleancontains(double x, double y, double width, double height)

        return s == null ? false : s.contains(x, y, width, height);
    
public booleancontains(java.awt.geom.Point2D p)

        if (p == null) {
            throw new NullPointerException();
        }
        return s == null ? false : s.contains(p);
    
public booleancontains(java.awt.geom.Rectangle2D r)

        if (r == null) {
            throw new NullPointerException();
        }
        return s == null ? false : s.contains(r);
    
public java.awt.geom.AreacreateTransformedArea(java.awt.geom.AffineTransform t)
Creates a new Area that is the result of transforming the data of this Area according to the specified AffineTransform.

param
t the transform to use to transform the data.
return
the new Area that is the result of transforming the data of this Area according to the specified AffineTransform.

        return s == null ? new Area() : new Area(t.createTransformedShape(s));
    
public booleanequals(java.awt.geom.Area obj)
Tests whether the object is equal to this Area.

param
obj the object to compare.
return
true, if successful.
throws
NotImplementedException if this method is not implemented.

        throw new RuntimeException("Not implemented"); //$NON-NLS-1$
    
public voidexclusiveOr(java.awt.geom.Area area)
Performs an exclusive or operation between this shape and the specified shape.

param
area the area to XOR against this area.
throws
NotImplementedException if this method is not implemented.

        throw new RuntimeException("Not implemented"); //$NON-NLS-1$
    
java.awt.geom.Rectangle2DextractRectangle()
Extracts a Rectangle2D from the source shape if the underlying shape data describes a rectangle.

return
a Rectangle2D object if the source shape is rectangle, or null if shape is empty or not rectangle.

        if (s == null) {
            return null;
        }
        float[] points = new float[12];
        int count = 0;
        PathIterator p = s.getPathIterator(null);
        float[] coords = new float[6];
        while (!p.isDone()) {
            int type = p.currentSegment(coords);
            if (count > 12 || type == PathIterator.SEG_QUADTO || type == PathIterator.SEG_CUBICTO) {
                return null;
            }
            points[count++] = coords[0];
            points[count++] = coords[1];
            p.next();
        }
        if (points[0] == points[6] && points[6] == points[8] && points[2] == points[4]
                && points[1] == points[3] && points[3] == points[9] && points[5] == points[7]) {
            return new Rectangle2D.Float(points[0], points[1], points[2] - points[0], points[7]
                    - points[1]);
        }
        return null;
    
public java.awt.RectanglegetBounds()

        return s == null ? new Rectangle() : s.getBounds();
    
public java.awt.geom.Rectangle2DgetBounds2D()

        return s == null ? new Rectangle2D.Double() : s.getBounds2D();
    
public java.awt.geom.PathIteratorgetPathIterator(java.awt.geom.AffineTransform t)

        return s == null ? new NullIterator() : s.getPathIterator(t);
    
public java.awt.geom.PathIteratorgetPathIterator(java.awt.geom.AffineTransform t, double flatness)

        return s == null ? new NullIterator() : s.getPathIterator(t, flatness);
    
public voidintersect(java.awt.geom.Area area)
Reduces the size of this Area by intersecting it with the specified Area if they are both rectangles.

see
java.awt.geom.Rectangle2D#intersect(Rectangle2D, Rectangle2D, Rectangle2D)
param
area the area.

        Rectangle2D src1 = extractRectangle();
        Rectangle2D src2 = area.extractRectangle();
        if (src1 != null && src2 != null) {
            Rectangle2D.intersect(src1, src2, (Rectangle2D)s);
        }
    
public booleanintersects(double x, double y, double width, double height)

        return s == null ? false : s.intersects(x, y, width, height);
    
public booleanintersects(java.awt.geom.Rectangle2D r)

        if (r == null) {
            throw new NullPointerException();
        }
        return s == null ? false : s.intersects(r);
    
public booleanisEmpty()
Checks if this Area is empty.

return
true, if this Area is empty.
throws
NotImplementedException if this method is not implemented.

        throw new RuntimeException("Not implemented"); //$NON-NLS-1$
    
public booleanisPolygonal()
Checks if this Area is polygonal.

return
true, if this Area is polygonal.
throws
NotImplementedException if this method is not implemented.

        throw new RuntimeException("Not implemented"); //$NON-NLS-1$
    
public booleanisRectangular()
Checks if this Area is rectangular.

return
true, if this Area is rectangular.
throws
NotImplementedException if this method is not implemented.

        throw new RuntimeException("Not implemented"); //$NON-NLS-1$
    
public booleanisSingular()
Checks if this Area is singular.

return
true, if this Area is singular.
throws
NotImplementedException if this method is not implemented.

        throw new RuntimeException("Not implemented"); //$NON-NLS-1$
    
public voidreset()
Resets the data of this Area.

throws
NotImplementedException if this method is not implemented.

        throw new RuntimeException("Not implemented"); //$NON-NLS-1$
    
public voidsubtract(java.awt.geom.Area area)
Subtract the specified area from this area.

param
area the area to subtract.
throws
NotImplementedException if this method is not implemented.

        throw new RuntimeException("Not implemented"); //$NON-NLS-1$
    
public voidtransform(java.awt.geom.AffineTransform t)
Transforms the data of this Area according to the specified AffineTransform.

param
t the transform to use to transform the data.

        s = t.createTransformedShape(s);