summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/ui/Spline.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/filtershow/ui/Spline.java')
-rw-r--r--src/com/android/gallery3d/filtershow/ui/Spline.java31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/filtershow/ui/Spline.java b/src/com/android/gallery3d/filtershow/ui/Spline.java
index 67840dc23..dd9aac1be 100644
--- a/src/com/android/gallery3d/filtershow/ui/Spline.java
+++ b/src/com/android/gallery3d/filtershow/ui/Spline.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.android.gallery3d.filtershow.ui;
@@ -68,6 +83,15 @@ public class Spline {
mCurrentControlPoint = point;
}
+ public void movePoint(int pick, float x, float y) {
+ if (pick < 0 || pick > mPoints.size() - 1) {
+ return;
+ }
+ ControlPoint point = mPoints.elementAt(pick);
+ point.x = x;
+ point.y = y;
+ }
+
public boolean isOriginal() {
if (this.getNbPoints() > 2) {
return false;
@@ -324,13 +348,14 @@ public class Spline {
return solution;
}
- public void addPoint(float x, float y) {
- addPoint(new ControlPoint(x, y));
+ public int addPoint(float x, float y) {
+ return addPoint(new ControlPoint(x, y));
}
- public void addPoint(ControlPoint v) {
+ public int addPoint(ControlPoint v) {
mPoints.add(v);
Collections.sort(mPoints);
+ return mPoints.indexOf(v);
}
public void deletePoint(int n) {