I found the following code in transform method of class PerspectiveTransform in JAI library:
public void transform(double[] srcPts, int srcOff,
double[] dstPts, int dstOff,
int numPts) {
if ( srcPts == null ) {
throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
}
if (dstPts == null) {
dstPts = new double[numPts * 2 + dstOff];
}
while (numPts-- > 0) {
double x = srcPts[srcOff++];
double y = srcPts[srcOff++];
double w = m20 * x + m21 * y + m22;
if (w == 0) {
dstPts[dstOff++] = x;
dstPts[dstOff++] = y;
} else {
dstPts[dstOff++] = (m00 * x + m01 * y + m02) / w;
dstPts[dstOff++] = (m10 * x + m11 * y + m12) / w;
}
}
}
Looks like if dstPts is null, then new array is created. But this array won't return outside, isn't it?