Commit 801079e2 authored by Andrey Pavlenko's avatar Andrey Pavlenko

partial implementation of complex out args in Java wrappers

parent 066039fd
This diff is collapsed.
......@@ -14,6 +14,14 @@ public class Point {
this(0, 0);
}
public Point(double[] vals) {
this();
if(vals!=null) {
x = vals.length>0 ? vals[0] : 0;
y = vals.length>1 ? vals[1] : 0;
}
}
public Point clone() {
return new Point(x, y);
}
......
......@@ -21,6 +21,15 @@ public class Point3 {
z = 0;
}
public Point3(double[] vals) {
this();
if(vals!=null) {
x = vals.length>0 ? vals[0] : 0;
y = vals.length>1 ? vals[1] : 0;
z = vals.length>2 ? vals[2] : 0;
}
}
public Point3 clone() {
return new Point3(x, y, z);
}
......
......@@ -27,6 +27,16 @@ public class Rect {
this((int)p.x, (int)p.y, (int)s.width, (int)s.height);
}
public Rect(double[] vals) {
this();
if(vals!=null) {
x = vals.length>0 ? (int)vals[0] : 0;
y = vals.length>1 ? (int)vals[1] : 0;
width = vals.length>2 ? (int)vals[2] : 0;
height = vals.length>3 ? (int)vals[3] : 0;
}
}
public Rect clone() {
return new Rect(x, y, width, height);
}
......
......@@ -17,6 +17,17 @@ public class RotatedRect {
this.angle = a;
}
public RotatedRect(double[] vals) {
this();
if(vals!=null) {
center.x = vals.length>0 ? (int)vals[0] : 0;
center.x = vals.length>1 ? (int)vals[1] : 0;
size.width = vals.length>2 ? (int)vals[2] : 0;
size.height = vals.length>3 ? (int)vals[3] : 0;
angle = vals.length>4 ? (int)vals[4] : 0;
}
}
public void points(Point pt[])
{
double _angle = angle*Math.PI/180.0;
......
......@@ -24,6 +24,15 @@ public class Scalar {
this(v0, 0, 0, 0);
}
public Scalar(double[] vals) {
if(vals!=null) {
v0 = vals.length>0 ? (int)vals[0] : 0;
v1 = vals.length>1 ? (int)vals[1] : 0;
v2 = vals.length>2 ? (int)vals[2] : 0;
v3 = vals.length>3 ? (int)vals[3] : 0;
}
}
public static Scalar all(double v) {
return new Scalar(v, v, v, v);
}
......
......@@ -19,6 +19,14 @@ public class Size {
height = (double) p.y;
}
public Size(double[] vals) {
this();
if(vals!=null) {
width = vals.length>0 ? vals[0] : 0;
height = vals.length>1 ? vals[1] : 0;
}
}
public double area() {
return width * height;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment