summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2013-08-23 13:31:31 -0700
committerGeorge Mount <mount@google.com>2013-11-20 07:39:26 -0800
commitc96c7b2e54965e30c8fb82295f1ca9f891ebd5e7 (patch)
treedeb03b8ecc52517f76b91472630c8deb0024dbdc /graphics/java
parent17a93ff13069f535b0a3b9f1c0f5430de0acb8db (diff)
downloadframeworks_base-c96c7b2e54965e30c8fb82295f1ca9f891ebd5e7.zip
frameworks_base-c96c7b2e54965e30c8fb82295f1ca9f891ebd5e7.tar.gz
frameworks_base-c96c7b2e54965e30c8fb82295f1ca9f891ebd5e7.tar.bz2
Add animations along a Path.
Change-Id: If03bd10a3961ff874e33489e1253146b8dadca33
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/Path.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java
index 5b04a91..3c42576 100644
--- a/graphics/java/android/graphics/Path.java
+++ b/graphics/java/android/graphics/Path.java
@@ -703,6 +703,28 @@ public class Path {
return mNativePath;
}
+ /**
+ * Approximate the <code>Path</code> with a series of line segments.
+ * This returns float[] with the array containing point components.
+ * There are three components for each point, in order:
+ * <ul>
+ * <li>Fraction along the length of the path that the point resides</li>
+ * <li>The x coordinate of the point</li>
+ * <li>The y coordinate of the point</li>
+ * </ul>
+ * <p>Two points may share the same fraction along its length when there is
+ * a move action within the Path.</p>
+ *
+ * @param acceptableError The acceptable error for a line on the
+ * Path. Typically this would be 0.5 so that
+ * the error is less than half a pixel.
+ * @return An array of components for points approximating the Path.
+ * @hide
+ */
+ public float[] approximate(float acceptableError) {
+ return native_approximate(mNativePath, acceptableError);
+ }
+
private static native int init1();
private static native int init2(int nPath);
private static native void native_reset(int nPath);
@@ -749,4 +771,5 @@ public class Path {
private static native void native_transform(int nPath, int matrix);
private static native boolean native_op(int path1, int path2, int op, int result);
private static native void finalizer(int nPath);
+ private static native float[] native_approximate(int nPath, float error);
}