summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/ui/ControlPoint.java
blob: 68b799a9e0ee62e9dc4dda255676e879fae4f5da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

package com.android.gallery3d.filtershow.ui;

public class ControlPoint implements Comparable {
    public ControlPoint(float px, float py) {
        x = px;
        y = py;
    }

    public ControlPoint multiply(float m) {
        return new ControlPoint(x * m, y * m);
    }

    public ControlPoint add(ControlPoint v) {
        return new ControlPoint(x + v.x, y + v.y);
    }

    public ControlPoint sub(ControlPoint v) {
        return new ControlPoint(x - v.x, y - v.y);
    }

    public float x;
    public float y;

    public ControlPoint copy() {
        return new ControlPoint(x, y);
    }

    @Override
    public int compareTo(Object another) {
        ControlPoint p = (ControlPoint) another;
        if (p.x < x) {
            return 1;
        } else if (p.x > x) {
            return -1;
        }
        return 0;
    }
}