Methods Summary |
---|
public native boolean | contains(int x, int y)Return true if the region contains the specified point
|
public int | describeContents()
return 0;
|
public boolean | equals(java.lang.Object obj)
if (obj == null || !(obj instanceof Region)) {
return false;
}
Region peer = (Region) obj;
return nativeEquals(mNativeRegion, peer.mNativeRegion);
|
protected void | finalize()
try {
nativeDestructor(mNativeRegion);
} finally {
super.finalize();
}
|
public Path | getBoundaryPath()Return the boundary of the region as a new Path. If the region is empty,
the path will also be empty.
Path path = new Path();
nativeGetBoundaryPath(mNativeRegion, path.ni());
return path;
|
public boolean | getBoundaryPath(Path path)Set the path to the boundary of the region. If the region is empty, the
path will also be empty.
return nativeGetBoundaryPath(mNativeRegion, path.ni());
|
public Rect | getBounds()Return a new Rect set to the bounds of the region. If the region is
empty, the Rect will be set to [0, 0, 0, 0]
Rect r = new Rect();
nativeGetBounds(mNativeRegion, r);
return r;
|
public boolean | getBounds(Rect r)Set the Rect to the bounds of the region. If the region is empty, the
Rect will be set to [0, 0, 0, 0]
if (r == null) {
throw new NullPointerException();
}
return nativeGetBounds(mNativeRegion, r);
|
public native boolean | isComplex()Return true if the region contains more than one rectangle
|
public native boolean | isEmpty()Return true if this region is empty
|
public native boolean | isRect()Return true if the region contains a single rectangle
|
private static native long | nativeConstructor()
|
private static native long | nativeCreateFromParcel(android.os.Parcel p)
|
private static native void | nativeDestructor(long native_region)
|
private static native boolean | nativeEquals(long native_r1, long native_r2)
|
private static native boolean | nativeGetBoundaryPath(long native_region, long native_path)
|
private static native boolean | nativeGetBounds(long native_region, Rect rect)
|
private static native boolean | nativeOp(long native_dst, int left, int top, int right, int bottom, int op)
|
private static native boolean | nativeOp(long native_dst, Rect rect, long native_region, int op)
|
private static native boolean | nativeOp(long native_dst, long native_region1, long native_region2, int op)
|
private static native boolean | nativeSetPath(long native_dst, long native_path, long native_clip)
|
private static native boolean | nativeSetRect(long native_dst, int left, int top, int right, int bottom)
|
private static native void | nativeSetRegion(long native_dst, long native_src)
|
private static native java.lang.String | nativeToString(long native_region)
|
private static native boolean | nativeWriteToParcel(long native_region, android.os.Parcel p)
|
final long | ni()
return mNativeRegion;
|
public static android.graphics.Region | obtain()
Region region = sPool.acquire();
return (region != null) ? region : new Region();
|
public static android.graphics.Region | obtain(android.graphics.Region other)
Region region = obtain();
region.set(other);
return region;
|
public boolean | op(Rect r, android.graphics.Region$Op op)Perform the specified Op on this region and the specified rect. Return
true if the result of the op is not empty.
return nativeOp(mNativeRegion, r.left, r.top, r.right, r.bottom,
op.nativeInt);
|
public boolean | op(int left, int top, int right, int bottom, android.graphics.Region$Op op)Perform the specified Op on this region and the specified rect. Return
true if the result of the op is not empty.
return nativeOp(mNativeRegion, left, top, right, bottom,
op.nativeInt);
|
public boolean | op(android.graphics.Region region, android.graphics.Region$Op op)Perform the specified Op on this region and the specified region. Return
true if the result of the op is not empty.
return op(this, region, op);
|
public boolean | op(Rect rect, android.graphics.Region region, android.graphics.Region$Op op)Set this region to the result of performing the Op on the specified rect
and region. Return true if the result is not empty.
return nativeOp(mNativeRegion, rect, region.mNativeRegion,
op.nativeInt);
|
public boolean | op(android.graphics.Region region1, android.graphics.Region region2, android.graphics.Region$Op op)Set this region to the result of performing the Op on the specified
regions. Return true if the result is not empty.
return nativeOp(mNativeRegion, region1.mNativeRegion,
region2.mNativeRegion, op.nativeInt);
|
public boolean | quickContains(Rect r)Return true if the region is a single rectangle (not complex) and it
contains the specified rectangle. Returning false is not a guarantee
that the rectangle is not contained by this region, but return true is a
guarantee that the rectangle is contained by this region.
return quickContains(r.left, r.top, r.right, r.bottom);
|
public native boolean | quickContains(int left, int top, int right, int bottom)Return true if the region is a single rectangle (not complex) and it
contains the specified rectangle. Returning false is not a guarantee
that the rectangle is not contained by this region, but return true is a
guarantee that the rectangle is contained by this region.
|
public boolean | quickReject(Rect r)Return true if the region is empty, or if the specified rectangle does
not intersect the region. Returning false is not a guarantee that they
intersect, but returning true is a guarantee that they do not.
return quickReject(r.left, r.top, r.right, r.bottom);
|
public native boolean | quickReject(int left, int top, int right, int bottom)Return true if the region is empty, or if the specified rectangle does
not intersect the region. Returning false is not a guarantee that they
intersect, but returning true is a guarantee that they do not.
|
public native boolean | quickReject(android.graphics.Region rgn)Return true if the region is empty, or if the specified region does not
intersect the region. Returning false is not a guarantee that they
intersect, but returning true is a guarantee that they do not.
|
public void | recycle()Recycles an instance.
setEmpty();
sPool.release(this);
|
public void | scale(float scale)Scale the region by the given scale amount. This re-constructs new region by
scaling the rects that this region consists of. New rectis are computed by scaling
coordinates by float, then rounded by roundf() function to integers. This may results
in less internal rects if 0 < scale < 1. Zero and Negative scale result in
an empty region. If this region is empty, do nothing.
scale(scale, null);
|
public native void | scale(float scale, android.graphics.Region dst)Set the dst region to the result of scaling this region by the given scale amount.
If this region is empty, then dst will be set to empty.
|
public boolean | set(android.graphics.Region region)Set the region to the specified region.
nativeSetRegion(mNativeRegion, region.mNativeRegion);
return true;
|
public boolean | set(Rect r)Set the region to the specified rectangle
return nativeSetRect(mNativeRegion, r.left, r.top, r.right, r.bottom);
|
public boolean | set(int left, int top, int right, int bottom)Set the region to the specified rectangle
return nativeSetRect(mNativeRegion, left, top, right, bottom);
|
public void | setEmpty()Set the region to the empty region
nativeSetRect(mNativeRegion, 0, 0, 0, 0);
|
public boolean | setPath(Path path, android.graphics.Region clip)Set the region to the area described by the path and clip.
Return true if the resulting region is non-empty. This produces a region
that is identical to the pixels that would be drawn by the path
(with no antialiasing).
return nativeSetPath(mNativeRegion, path.ni(), clip.mNativeRegion);
|
public java.lang.String | toString()
return nativeToString(mNativeRegion);
|
public void | translate(int dx, int dy)Translate the region by [dx, dy]. If the region is empty, do nothing.
translate(dx, dy, null);
|
public native void | translate(int dx, int dy, android.graphics.Region dst)Set the dst region to the result of translating this region by [dx, dy].
If this region is empty, then dst will be set to empty.
|
public final boolean | union(Rect r)
return op(r, Op.UNION);
|
public void | writeToParcel(android.os.Parcel p, int flags)Write the region and its pixels to the parcel. The region can be
rebuilt from the parcel by calling CREATOR.createFromParcel().
if (!nativeWriteToParcel(mNativeRegion, p)) {
throw new RuntimeException();
}
|