Methods Summary |
---|
private static void | checkPointArrays(float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount)
// check for too-small and too-big indices
int srcStop = srcIndex + (pointCount << 1);
int dstStop = dstIndex + (pointCount << 1);
if ((pointCount | srcIndex | dstIndex | srcStop | dstStop) < 0 ||
srcStop > src.length || dstStop > dst.length) {
throw new ArrayIndexOutOfBoundsException();
}
|
public boolean | equals(java.lang.Object obj)Returns true iff obj is a Matrix and its values equal our values.
//if (obj == this) return true; -- NaN value would mean matrix != itself
if (!(obj instanceof Matrix)) return false;
return native_equals(native_instance, ((Matrix)obj).native_instance);
|
protected void | finalize()
try {
finalizer(native_instance);
} finally {
super.finalize();
}
|
private static native void | finalizer(long native_instance)
|
public void | getValues(float[] values)Copy 9 values from the matrix into the array.
if (values.length < 9) {
throw new ArrayIndexOutOfBoundsException();
}
native_getValues(native_instance, values);
|
public int | hashCode()
// This should generate the hash code by performing some arithmetic operation on all
// the matrix elements -- our equals() does an element-by-element comparison, and we
// need to ensure that the hash code for two equal objects is the same. We're not
// really using this at the moment, so we take the easy way out.
return 44;
|
public boolean | invert(android.graphics.Matrix inverse)If this matrix can be inverted, return true and if inverse is not null,
set inverse to be the inverse of this matrix. If this matrix cannot be
inverted, ignore inverse and return false.
return native_invert(native_instance, inverse.native_instance);
|
public boolean | isAffine()Gets whether this matrix is affine. An affine matrix preserves
straight lines and has no perspective.
return native_isAffine(native_instance);
|
public boolean | isIdentity()Returns true if the matrix is identity.
This maybe faster than testing if (getType() == 0)
return native_isIdentity(native_instance);
|
public void | mapPoints(float[] dst, int dstIndex, float[] src, int srcIndex, int pointCount)Apply this matrix to the array of 2D points specified by src, and write
the transformed points into the array of points specified by dst. The
two arrays represent their "points" as pairs of floats [x, y].
checkPointArrays(src, srcIndex, dst, dstIndex, pointCount);
native_mapPoints(native_instance, dst, dstIndex, src, srcIndex,
pointCount, true);
|
public void | mapPoints(float[] dst, float[] src)Apply this matrix to the array of 2D points specified by src, and write
the transformed points into the array of points specified by dst. The
two arrays represent their "points" as pairs of floats [x, y].
if (dst.length != src.length) {
throw new ArrayIndexOutOfBoundsException();
}
mapPoints(dst, 0, src, 0, dst.length >> 1);
|
public void | mapPoints(float[] pts)Apply this matrix to the array of 2D points, and write the transformed
points back into the array
mapPoints(pts, 0, pts, 0, pts.length >> 1);
|
public float | mapRadius(float radius)Return the mean radius of a circle after it has been mapped by
this matrix. NOTE: in perspective this value assumes the circle
has its center at the origin.
return native_mapRadius(native_instance, radius);
|
public boolean | mapRect(RectF dst, RectF src)Apply this matrix to the src rectangle, and write the transformed
rectangle into dst. This is accomplished by transforming the 4 corners of
src, and then setting dst to the bounds of those points.
if (dst == null || src == null) {
throw new NullPointerException();
}
return native_mapRect(native_instance, dst, src);
|
public boolean | mapRect(RectF rect)Apply this matrix to the rectangle, and write the transformed rectangle
back into it. This is accomplished by transforming the 4 corners of rect,
and then setting it to the bounds of those points
return mapRect(rect, rect);
|
public void | mapVectors(float[] dst, int dstIndex, float[] src, int srcIndex, int vectorCount)Apply this matrix to the array of 2D vectors specified by src, and write
the transformed vectors into the array of vectors specified by dst. The
two arrays represent their "vectors" as pairs of floats [x, y].
Note: this method does not apply the translation associated with the matrix. Use
{@link Matrix#mapPoints(float[], int, float[], int, int)} if you want the translation
to be applied.
checkPointArrays(src, srcIndex, dst, dstIndex, vectorCount);
native_mapPoints(native_instance, dst, dstIndex, src, srcIndex,
vectorCount, false);
|
public void | mapVectors(float[] dst, float[] src)Apply this matrix to the array of 2D vectors specified by src, and write
the transformed vectors into the array of vectors specified by dst. The
two arrays represent their "vectors" as pairs of floats [x, y].
Note: this method does not apply the translation associated with the matrix. Use
{@link Matrix#mapPoints(float[], float[])} if you want the translation to be applied.
if (dst.length != src.length) {
throw new ArrayIndexOutOfBoundsException();
}
mapVectors(dst, 0, src, 0, dst.length >> 1);
|
public void | mapVectors(float[] vecs)Apply this matrix to the array of 2D vectors, and write the transformed
vectors back into the array.
Note: this method does not apply the translation associated with the matrix. Use
{@link Matrix#mapPoints(float[])} if you want the translation to be applied.
mapVectors(vecs, 0, vecs, 0, vecs.length >> 1);
|
private static native long | native_create(long native_src_or_zero)
|
private static native boolean | native_equals(long native_a, long native_b)
|
private static native void | native_getValues(long native_object, float[] values)
|
private static native boolean | native_invert(long native_object, long native_inverse)
|
private static native boolean | native_isAffine(long native_object)
|
private static native boolean | native_isIdentity(long native_object)
|
private static native void | native_mapPoints(long native_object, float[] dst, int dstIndex, float[] src, int srcIndex, int ptCount, boolean isPts)
|
private static native float | native_mapRadius(long native_object, float radius)
|
private static native boolean | native_mapRect(long native_object, RectF dst, RectF src)
|
private static native void | native_postConcat(long native_object, long native_other_matrix)
|
private static native void | native_postRotate(long native_object, float degrees, float px, float py)
|
private static native void | native_postRotate(long native_object, float degrees)
|
private static native void | native_postScale(long native_object, float sx, float sy, float px, float py)
|
private static native void | native_postScale(long native_object, float sx, float sy)
|
private static native void | native_postSkew(long native_object, float kx, float ky, float px, float py)
|
private static native void | native_postSkew(long native_object, float kx, float ky)
|
private static native void | native_postTranslate(long native_object, float dx, float dy)
|
private static native void | native_preConcat(long native_object, long native_other_matrix)
|
private static native void | native_preRotate(long native_object, float degrees, float px, float py)
|
private static native void | native_preRotate(long native_object, float degrees)
|
private static native void | native_preScale(long native_object, float sx, float sy, float px, float py)
|
private static native void | native_preScale(long native_object, float sx, float sy)
|
private static native void | native_preSkew(long native_object, float kx, float ky, float px, float py)
|
private static native void | native_preSkew(long native_object, float kx, float ky)
|
private static native void | native_preTranslate(long native_object, float dx, float dy)
|
private static native boolean | native_rectStaysRect(long native_object)
|
private static native void | native_reset(long native_object)
|
private static native void | native_set(long native_object, long native_other)
|
private static native void | native_setConcat(long native_object, long native_a, long native_b)
|
private static native boolean | native_setPolyToPoly(long native_object, float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount)
|
private static native boolean | native_setRectToRect(long native_object, RectF src, RectF dst, int stf)
|
private static native void | native_setRotate(long native_object, float degrees, float px, float py)
|
private static native void | native_setRotate(long native_object, float degrees)
|
private static native void | native_setScale(long native_object, float sx, float sy, float px, float py)
|
private static native void | native_setScale(long native_object, float sx, float sy)
|
private static native void | native_setSinCos(long native_object, float sinValue, float cosValue, float px, float py)
|
private static native void | native_setSinCos(long native_object, float sinValue, float cosValue)
|
private static native void | native_setSkew(long native_object, float kx, float ky, float px, float py)
|
private static native void | native_setSkew(long native_object, float kx, float ky)
|
private static native void | native_setTranslate(long native_object, float dx, float dy)
|
private static native void | native_setValues(long native_object, float[] values)
|
final long | ni()
return native_instance;
|
public boolean | postConcat(android.graphics.Matrix other)Postconcats the matrix with the specified matrix.
M' = other * M
native_postConcat(native_instance, other.native_instance);
return true;
|
public boolean | postRotate(float degrees, float px, float py)Postconcats the matrix with the specified rotation.
M' = R(degrees, px, py) * M
native_postRotate(native_instance, degrees, px, py);
return true;
|
public boolean | postRotate(float degrees)Postconcats the matrix with the specified rotation.
M' = R(degrees) * M
native_postRotate(native_instance, degrees);
return true;
|
public boolean | postScale(float sx, float sy, float px, float py)Postconcats the matrix with the specified scale.
M' = S(sx, sy, px, py) * M
native_postScale(native_instance, sx, sy, px, py);
return true;
|
public boolean | postScale(float sx, float sy)Postconcats the matrix with the specified scale.
M' = S(sx, sy) * M
native_postScale(native_instance, sx, sy);
return true;
|
public boolean | postSkew(float kx, float ky, float px, float py)Postconcats the matrix with the specified skew.
M' = K(kx, ky, px, py) * M
native_postSkew(native_instance, kx, ky, px, py);
return true;
|
public boolean | postSkew(float kx, float ky)Postconcats the matrix with the specified skew.
M' = K(kx, ky) * M
native_postSkew(native_instance, kx, ky);
return true;
|
public boolean | postTranslate(float dx, float dy)Postconcats the matrix with the specified translation.
M' = T(dx, dy) * M
native_postTranslate(native_instance, dx, dy);
return true;
|
public boolean | preConcat(android.graphics.Matrix other)Preconcats the matrix with the specified matrix.
M' = M * other
native_preConcat(native_instance, other.native_instance);
return true;
|
public boolean | preRotate(float degrees, float px, float py)Preconcats the matrix with the specified rotation.
M' = M * R(degrees, px, py)
native_preRotate(native_instance, degrees, px, py);
return true;
|
public boolean | preRotate(float degrees)Preconcats the matrix with the specified rotation.
M' = M * R(degrees)
native_preRotate(native_instance, degrees);
return true;
|
public boolean | preScale(float sx, float sy, float px, float py)Preconcats the matrix with the specified scale.
M' = M * S(sx, sy, px, py)
native_preScale(native_instance, sx, sy, px, py);
return true;
|
public boolean | preScale(float sx, float sy)Preconcats the matrix with the specified scale.
M' = M * S(sx, sy)
native_preScale(native_instance, sx, sy);
return true;
|
public boolean | preSkew(float kx, float ky, float px, float py)Preconcats the matrix with the specified skew.
M' = M * K(kx, ky, px, py)
native_preSkew(native_instance, kx, ky, px, py);
return true;
|
public boolean | preSkew(float kx, float ky)Preconcats the matrix with the specified skew.
M' = M * K(kx, ky)
native_preSkew(native_instance, kx, ky);
return true;
|
public boolean | preTranslate(float dx, float dy)Preconcats the matrix with the specified translation.
M' = M * T(dx, dy)
native_preTranslate(native_instance, dx, dy);
return true;
|
public void | printShortString(java.io.PrintWriter pw)Print short string, to optimize dumping.
float[] values = new float[9];
getValues(values);
pw.print('[");
pw.print(values[0]); pw.print(", "); pw.print(values[1]); pw.print(", ");
pw.print(values[2]); pw.print("][");
pw.print(values[3]); pw.print(", "); pw.print(values[4]); pw.print(", ");
pw.print(values[5]); pw.print("][");
pw.print(values[6]); pw.print(", "); pw.print(values[7]); pw.print(", ");
pw.print(values[8]); pw.print(']");
|
public boolean | rectStaysRect()Returns true if will map a rectangle to another rectangle. This can be
true if the matrix is identity, scale-only, or rotates a multiple of 90
degrees.
return native_rectStaysRect(native_instance);
|
public void | reset()Set the matrix to identity
native_reset(native_instance);
|
public void | set(android.graphics.Matrix src)(deep) copy the src matrix into this matrix. If src is null, reset this
matrix to the identity matrix.
if (src == null) {
reset();
} else {
native_set(native_instance, src.native_instance);
}
|
public boolean | setConcat(android.graphics.Matrix a, android.graphics.Matrix b)Set the matrix to the concatenation of the two specified matrices and
return true.
Either of the two matrices may also be the target matrix, that is
matrixA.setConcat(matrixA, matrixB); is valid.
In {@link android.os.Build.VERSION_CODES#GINGERBREAD_MR1} and below, this
function returns true only if the result can be represented. In
{@link android.os.Build.VERSION_CODES#HONEYCOMB} and above, it always returns true.
native_setConcat(native_instance, a.native_instance, b.native_instance);
return true;
|
public boolean | setPolyToPoly(float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount)Set the matrix such that the specified src points would map to the
specified dst points. The "points" are represented as an array of floats,
order [x0, y0, x1, y1, ...], where each "point" is 2 float values.
if (pointCount > 4) {
throw new IllegalArgumentException();
}
checkPointArrays(src, srcIndex, dst, dstIndex, pointCount);
return native_setPolyToPoly(native_instance, src, srcIndex,
dst, dstIndex, pointCount);
|
public boolean | setRectToRect(RectF src, RectF dst, android.graphics.Matrix$ScaleToFit stf)Set the matrix to the scale and translate values that map the source
rectangle to the destination rectangle, returning true if the the result
can be represented.
if (dst == null || src == null) {
throw new NullPointerException();
}
return native_setRectToRect(native_instance, src, dst, stf.nativeInt);
|
public void | setRotate(float degrees, float px, float py)Set the matrix to rotate by the specified number of degrees, with a pivot
point at (px, py). The pivot point is the coordinate that should remain
unchanged by the specified transformation.
native_setRotate(native_instance, degrees, px, py);
|
public void | setRotate(float degrees)Set the matrix to rotate about (0,0) by the specified number of degrees.
native_setRotate(native_instance, degrees);
|
public void | setScale(float sx, float sy, float px, float py)Set the matrix to scale by sx and sy, with a pivot point at (px, py).
The pivot point is the coordinate that should remain unchanged by the
specified transformation.
native_setScale(native_instance, sx, sy, px, py);
|
public void | setScale(float sx, float sy)Set the matrix to scale by sx and sy.
native_setScale(native_instance, sx, sy);
|
public void | setSinCos(float sinValue, float cosValue, float px, float py)Set the matrix to rotate by the specified sine and cosine values, with a
pivot point at (px, py). The pivot point is the coordinate that should
remain unchanged by the specified transformation.
native_setSinCos(native_instance, sinValue, cosValue, px, py);
|
public void | setSinCos(float sinValue, float cosValue)Set the matrix to rotate by the specified sine and cosine values.
native_setSinCos(native_instance, sinValue, cosValue);
|
public void | setSkew(float kx, float ky, float px, float py)Set the matrix to skew by sx and sy, with a pivot point at (px, py).
The pivot point is the coordinate that should remain unchanged by the
specified transformation.
native_setSkew(native_instance, kx, ky, px, py);
|
public void | setSkew(float kx, float ky)Set the matrix to skew by sx and sy.
native_setSkew(native_instance, kx, ky);
|
public void | setTranslate(float dx, float dy)Set the matrix to translate by (dx, dy).
native_setTranslate(native_instance, dx, dy);
|
public void | setValues(float[] values)Copy 9 values from the array into the matrix.
Depending on the implementation of Matrix, these may be
transformed into 16.16 integers in the Matrix, such that
a subsequent call to getValues() will not yield exactly
the same values.
if (values.length < 9) {
throw new ArrayIndexOutOfBoundsException();
}
native_setValues(native_instance, values);
|
public java.lang.String | toShortString()
StringBuilder sb = new StringBuilder(64);
toShortString(sb);
return sb.toString();
|
public void | toShortString(java.lang.StringBuilder sb)
float[] values = new float[9];
getValues(values);
sb.append('[");
sb.append(values[0]); sb.append(", "); sb.append(values[1]); sb.append(", ");
sb.append(values[2]); sb.append("][");
sb.append(values[3]); sb.append(", "); sb.append(values[4]); sb.append(", ");
sb.append(values[5]); sb.append("][");
sb.append(values[6]); sb.append(", "); sb.append(values[7]); sb.append(", ");
sb.append(values[8]); sb.append(']");
|
public java.lang.String | toString()
StringBuilder sb = new StringBuilder(64);
sb.append("Matrix{");
toShortString(sb);
sb.append('}");
return sb.toString();
|