summaryrefslogtreecommitdiffstats
path: root/graphics/java/android/graphics/Region.java
diff options
context:
space:
mode:
authorMitsuru Oshima <oshima@google.com>2009-05-11 17:11:37 -0700
committerMitsuru Oshima <oshima@google.com>2009-05-12 15:40:07 -0700
commitb10f138e125b5656e810901d14c5f956ff5d9b64 (patch)
tree4ae9530582c5cff92909e0ff8dcd66e8637a94f6 /graphics/java/android/graphics/Region.java
parent7e3e04c144182c6807c66646b3f988beaba1720e (diff)
downloadframeworks_base-b10f138e125b5656e810901d14c5f956ff5d9b64.zip
frameworks_base-b10f138e125b5656e810901d14c5f956ff5d9b64.tar.gz
frameworks_base-b10f138e125b5656e810901d14c5f956ff5d9b64.tar.bz2
* Add regoin scaling for transparent support
Diffstat (limited to 'graphics/java/android/graphics/Region.java')
-rw-r--r--graphics/java/android/graphics/Region.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/Region.java b/graphics/java/android/graphics/Region.java
index 544ff4f..2b080aa 100644
--- a/graphics/java/android/graphics/Region.java
+++ b/graphics/java/android/graphics/Region.java
@@ -211,6 +211,26 @@ public class Region implements Parcelable {
*/
public native void translate(int dx, int dy, Region dst);
+ /**
+ * 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.
+ *
+ * @hide
+ */
+ public void scale(float scale) {
+ scale(scale, null);
+ }
+
+ /**
+ * 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.
+ * @hide
+ */
+ public native void scale(float scale, Region dst);
+
public final boolean union(Rect r) {
return op(r, Op.UNION);
}
@@ -294,7 +314,16 @@ public class Region implements Parcelable {
throw new RuntimeException();
}
}
-
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof Region)) {
+ return false;
+ }
+ Region peer = (Region) obj;
+ return nativeEquals(mNativeRegion, peer.mNativeRegion);
+ }
+
protected void finalize() throws Throwable {
nativeDestructor(mNativeRegion);
}
@@ -340,5 +369,7 @@ public class Region implements Parcelable {
private static native boolean nativeWriteToParcel(int native_region,
Parcel p);
+ private static native boolean nativeEquals(int native_r1, int native_r2);
+
private final int mNativeRegion;
}