summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2013-11-20 15:46:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-11-20 15:47:00 +0000
commit34d8519de44f301ce0b7196e248e58345d3cd35a (patch)
treefaee178c7d84aae201a117c7195509879af4cf50 /graphics
parent7acec30ac7d5b2fba11757a2d2e3ad351be23441 (diff)
parentc96c7b2e54965e30c8fb82295f1ca9f891ebd5e7 (diff)
downloadframeworks_base-34d8519de44f301ce0b7196e248e58345d3cd35a.zip
frameworks_base-34d8519de44f301ce0b7196e248e58345d3cd35a.tar.gz
frameworks_base-34d8519de44f301ce0b7196e248e58345d3cd35a.tar.bz2
Merge "Add animations along a Path."
Diffstat (limited to 'graphics')
-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 09481d4..1a7e3ec 100644
--- a/graphics/java/android/graphics/Path.java
+++ b/graphics/java/android/graphics/Path.java
@@ -692,6 +692,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);
@@ -738,4 +760,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);
}