Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/graphics/Matrix#constants) \| [Fields](https://developer.android.com/reference/android/graphics/Matrix#lfields) \| [Ctors](https://developer.android.com/reference/android/graphics/Matrix#pubctors) \| [Methods](https://developer.android.com/reference/android/graphics/Matrix#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/graphics/Matrix#inhmethods)

# Matrix

*** ** * ** ***


`
public


class
Matrix
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.graphics.Matrix |

<br />

*** ** * ** ***

The Matrix class holds a 3x3 matrix for transforming coordinates.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/graphics/Matrix#MPERSP_0` |
| `int` | `https://developer.android.com/reference/android/graphics/Matrix#MPERSP_1` |
| `int` | `https://developer.android.com/reference/android/graphics/Matrix#MPERSP_2` |
| `int` | `https://developer.android.com/reference/android/graphics/Matrix#MSCALE_X` |
| `int` | `https://developer.android.com/reference/android/graphics/Matrix#MSCALE_Y` |
| `int` | `https://developer.android.com/reference/android/graphics/Matrix#MSKEW_X` |
| `int` | `https://developer.android.com/reference/android/graphics/Matrix#MSKEW_Y` |
| `int` | `https://developer.android.com/reference/android/graphics/Matrix#MTRANS_X` |
| `int` | `https://developer.android.com/reference/android/graphics/Matrix#MTRANS_Y` |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/graphics/Matrix` | `https://developer.android.com/reference/android/graphics/Matrix#IDENTITY_MATRIX` The identity matrix. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/Matrix#Matrix()() ` Create an identity matrix |
| ` https://developer.android.com/reference/android/graphics/Matrix#Matrix(android.graphics.Matrix)(https://developer.android.com/reference/android/graphics/Matrix src) ` Create a matrix that is a (deep) copy of src |

| ### Public methods ||
|---|---|
| ` final void` | ` https://developer.android.com/reference/android/graphics/Matrix#dump(java.io.PrintWriter)(https://developer.android.com/reference/java/io/PrintWriter pw) ` Dumps a human-readable shortened string of the matrix into the given stream |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Returns true iff obj is a Matrix and its values equal our values. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#getValues(float[])(float[] values) ` Copy 9 values from the matrix into the array. |
| ` int` | ` https://developer.android.com/reference/android/graphics/Matrix#hashCode()() ` Returns a hash code value for the object. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#invert(android.graphics.Matrix)(https://developer.android.com/reference/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. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#isAffine()() ` Gets whether this matrix is affine. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#isIdentity()() ` Returns true if the matrix is identity. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#mapPoints(float[],%20int,%20float[],%20int,%20int)(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. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#mapPoints(float[],%20float[])(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. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#mapPoints(float[])(float[] pts) ` Apply this matrix to the array of 2D points, and write the transformed points back into the array |
| ` float` | ` https://developer.android.com/reference/android/graphics/Matrix#mapRadius(float)(float radius) ` Return the mean radius of a circle after it has been mapped by this matrix. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#mapRect(android.graphics.RectF)(https://developer.android.com/reference/android/graphics/RectF rect) ` Apply this matrix to the rectangle, and write the transformed rectangle back into it. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#mapRect(android.graphics.RectF,%20android.graphics.RectF)(https://developer.android.com/reference/android/graphics/RectF dst, https://developer.android.com/reference/android/graphics/RectF src) ` Apply this matrix to the src rectangle, and write the transformed rectangle into dst. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#mapVectors(float[])(float[] vecs) ` Apply this matrix to the array of 2D vectors, and write the transformed vectors back into the array. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#mapVectors(float[],%20int,%20float[],%20int,%20int)(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. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#mapVectors(float[],%20float[])(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. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#postConcat(android.graphics.Matrix)(https://developer.android.com/reference/android/graphics/Matrix other) ` Postconcats the matrix with the specified matrix. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#postRotate(float,%20float,%20float)(float degrees, float px, float py) ` Postconcats the matrix with the specified rotation. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#postRotate(float)(float degrees) ` Postconcats the matrix with the specified rotation. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#postScale(float,%20float,%20float,%20float)(float sx, float sy, float px, float py) ` Postconcats the matrix with the specified scale. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#postScale(float,%20float)(float sx, float sy) ` Postconcats the matrix with the specified scale. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#postSkew(float,%20float)(float kx, float ky) ` Postconcats the matrix with the specified skew. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#postSkew(float,%20float,%20float,%20float)(float kx, float ky, float px, float py) ` Postconcats the matrix with the specified skew. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#postTranslate(float,%20float)(float dx, float dy) ` Postconcats the matrix with the specified translation. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#preConcat(android.graphics.Matrix)(https://developer.android.com/reference/android/graphics/Matrix other) ` Preconcats the matrix with the specified matrix. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#preRotate(float)(float degrees) ` Preconcats the matrix with the specified rotation. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#preRotate(float,%20float,%20float)(float degrees, float px, float py) ` Preconcats the matrix with the specified rotation. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#preScale(float,%20float)(float sx, float sy) ` Preconcats the matrix with the specified scale. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#preScale(float,%20float,%20float,%20float)(float sx, float sy, float px, float py) ` Preconcats the matrix with the specified scale. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#preSkew(float,%20float)(float kx, float ky) ` Preconcats the matrix with the specified skew. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#preSkew(float,%20float,%20float,%20float)(float kx, float ky, float px, float py) ` Preconcats the matrix with the specified skew. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#preTranslate(float,%20float)(float dx, float dy) ` Preconcats the matrix with the specified translation. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#rectStaysRect()() ` Returns true if will map a rectangle to another rectangle. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#reset()() ` Set the matrix to identity |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#set(android.graphics.Matrix)(https://developer.android.com/reference/android/graphics/Matrix src) ` (deep) copy the src matrix into this matrix. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#setConcat(android.graphics.Matrix,%20android.graphics.Matrix)(https://developer.android.com/reference/android/graphics/Matrix a, https://developer.android.com/reference/android/graphics/Matrix b) ` Set the matrix to the concatenation of the two specified matrices and return true. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#setPolyToPoly(float[],%20int,%20float[],%20int,%20int)(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. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Matrix#setRectToRect(android.graphics.RectF,%20android.graphics.RectF,%20android.graphics.Matrix.ScaleToFit)(https://developer.android.com/reference/android/graphics/RectF src, https://developer.android.com/reference/android/graphics/RectF dst, https://developer.android.com/reference/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 result can be represented. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setRotate(float,%20float,%20float)(float degrees, float px, float py) ` Set the matrix to rotate by the specified number of degrees, with a pivot point at (px, py). |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setRotate(float)(float degrees) ` Set the matrix to rotate about (0,0) by the specified number of degrees. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setScale(float,%20float)(float sx, float sy) ` Set the matrix to scale by sx and sy. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setScale(float,%20float,%20float,%20float)(float sx, float sy, float px, float py) ` Set the matrix to scale by sx and sy, with a pivot point at (px, py). |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setSinCos(float,%20float,%20float,%20float)(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). |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setSinCos(float,%20float)(float sinValue, float cosValue) ` Set the matrix to rotate by the specified sine and cosine values. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setSkew(float,%20float)(float kx, float ky) ` Set the matrix to skew by sx and sy. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setSkew(float,%20float,%20float,%20float)(float kx, float ky, float px, float py) ` Set the matrix to skew by sx and sy, with a pivot point at (px, py). |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setTranslate(float,%20float)(float dx, float dy) ` Set the matrix to translate by (dx, dy). |
| ` void` | ` https://developer.android.com/reference/android/graphics/Matrix#setValues(float[])(float[] values) ` Copy 9 values from the array into the matrix. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/graphics/Matrix#toShortString()() ` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/graphics/Matrix#toString()() ` Returns a string representation of the object. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Constants

### MPERSP_0

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MPERSP_0
```

<br />

<br />

Constant Value:

6
(0x00000006)


### MPERSP_1

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MPERSP_1
```

<br />

<br />

Constant Value:

7
(0x00000007)


### MPERSP_2

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MPERSP_2
```

<br />

<br />

Constant Value:

8
(0x00000008)


### MSCALE_X

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MSCALE_X
```

<br />

<br />

Constant Value:

0
(0x00000000)


### MSCALE_Y

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MSCALE_Y
```

<br />

<br />

Constant Value:

4
(0x00000004)


### MSKEW_X

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MSKEW_X
```

<br />

<br />

Constant Value:

1
(0x00000001)


### MSKEW_Y

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MSKEW_Y
```

<br />

<br />

Constant Value:

3
(0x00000003)


### MTRANS_X

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MTRANS_X
```

<br />

<br />

Constant Value:

2
(0x00000002)


### MTRANS_Y

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MTRANS_Y
```

<br />

<br />

Constant Value:

5
(0x00000005)


## Fields

### IDENTITY_MATRIX

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Matrix IDENTITY_MATRIX
```

The identity matrix. Multiplying by another matrix `M` returns `M`. This matrix
is immutable, and attempting to modify it will throw an `https://developer.android.com/reference/java/lang/IllegalStateException`.

<br />

## Public constructors

### Matrix

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Matrix ()
```

Create an identity matrix

<br />

### Matrix

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Matrix (Matrix src)
```

Create a matrix that is a (deep) copy of src

<br />

| Parameters ||
|---|---|
| `src` | `Matrix`: The matrix to copy into this matrix <br /> |

## Public methods

### dump

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final void dump (PrintWriter pw)
```

Dumps a human-readable shortened string of the matrix into the given
stream

<br />

| Parameters ||
|---|---|
| `pw` | `PrintWriter`: The `https://developer.android.com/reference/java/io/PrintWriter` into which the string representation of the matrix will be written. This value cannot be `null`. <br /> |

### equals

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object obj)
```

Returns true iff obj is a Matrix and its values equal our values.

<br />

| Parameters ||
|---|---|
| `obj` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getValues

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void getValues (float[] values)
```

Copy 9 values from the matrix into the array.

<br />

| Parameters ||
|---|---|
| `values` | `float` <br /> |

### hashCode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
`https://developer.android.com/reference/java/util/HashMap`.


The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### invert

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean invert (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.

<br />

| Parameters ||
|---|---|
| `inverse` | `Matrix` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isAffine

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isAffine ()
```

Gets whether this matrix is affine. An affine matrix preserves straight lines and has no
perspective.

<br />

| Returns ||
|---|---|
| `boolean` | Whether the matrix is affine. <br /> |

### isIdentity

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isIdentity ()
```

Returns true if the matrix is identity. This maybe faster than testing if (getType() == 0)

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### mapPoints

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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\].

<br />

| Parameters ||
|---|---|
| `dst` | `float`: The array of dst points (x,y pairs) <br /> |
| `dstIndex` | `int`: The index of the first \[x,y\] pair of dst floats <br /> |
| `src` | `float`: The array of src points (x,y pairs) <br /> |
| `srcIndex` | `int`: The index of the first \[x,y\] pair of src floats <br /> |
| `pointCount` | `int`: The number of points (x,y pairs) to transform <br /> |

### mapPoints

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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\].

<br />

| Parameters ||
|---|---|
| `dst` | `float`: The array of dst points (x,y pairs) <br /> |
| `src` | `float`: The array of src points (x,y pairs) <br /> |

### mapPoints

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void mapPoints (float[] pts)
```

Apply this matrix to the array of 2D points, and write the transformed points back into the
array

<br />

| Parameters ||
|---|---|
| `pts` | `float`: The array \[x0, y0, x1, y1, ...\] of points to transform. <br /> |

### mapRadius

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `radius` | `float` <br /> |

| Returns ||
|---|---|
| `float` | <br /> |

### mapRect

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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

<br />

| Parameters ||
|---|---|
| `rect` | `RectF`: The rectangle to transform. <br /> |

| Returns ||
|---|---|
| `boolean` | the result of calling rectStaysRect() <br /> |

### mapRect

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `dst` | `RectF`: Where the transformed rectangle is written. <br /> |
| `src` | `RectF`: The original rectangle to be transformed. <br /> |

| Returns ||
|---|---|
| `boolean` | the result of calling rectStaysRect() <br /> |

### mapVectors

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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
`https://developer.android.com/reference/android/graphics/Matrix#mapPoints(float[])` if you want the translation to be applied.

<br />

| Parameters ||
|---|---|
| `vecs` | `float`: The array \[x0, y0, x1, y1, ...\] of vectors to transform. <br /> |

### mapVectors

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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 `https://developer.android.com/reference/android/graphics/Matrix#mapPoints(float[],%20int,%20float[],%20int,%20int)` if you want the
translation to be applied.

<br />

| Parameters ||
|---|---|
| `dst` | `float`: The array of dst vectors (x,y pairs) <br /> |
| `dstIndex` | `int`: The index of the first \[x,y\] pair of dst floats <br /> |
| `src` | `float`: The array of src vectors (x,y pairs) <br /> |
| `srcIndex` | `int`: The index of the first \[x,y\] pair of src floats <br /> |
| `vectorCount` | `int`: The number of vectors (x,y pairs) to transform <br /> |

### mapVectors

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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 `https://developer.android.com/reference/android/graphics/Matrix#mapPoints(float[],%20float[])` if you want the translation to be
applied.

<br />

| Parameters ||
|---|---|
| `dst` | `float`: The array of dst vectors (x,y pairs) <br /> |
| `src` | `float`: The array of src vectors (x,y pairs) <br /> |

### postConcat

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean postConcat (Matrix other)
```

Postconcats the matrix with the specified matrix. M' = other \* M

<br />

| Parameters ||
|---|---|
| `other` | `Matrix` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### postRotate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean postRotate (float degrees, 
                float px, 
                float py)
```

Postconcats the matrix with the specified rotation. M' = R(degrees, px, py) \* M

<br />

| Parameters ||
|---|---|
| `degrees` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### postRotate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean postRotate (float degrees)
```

Postconcats the matrix with the specified rotation. M' = R(degrees) \* M

<br />

| Parameters ||
|---|---|
| `degrees` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### postScale

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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

<br />

| Parameters ||
|---|---|
| `sx` | `float` <br /> |
| `sy` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### postScale

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean postScale (float sx, 
                float sy)
```

Postconcats the matrix with the specified scale. M' = S(sx, sy) \* M

<br />

| Parameters ||
|---|---|
| `sx` | `float` <br /> |
| `sy` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### postSkew

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean postSkew (float kx, 
                float ky)
```

Postconcats the matrix with the specified skew. M' = K(kx, ky) \* M

<br />

| Parameters ||
|---|---|
| `kx` | `float` <br /> |
| `ky` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### postSkew

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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

<br />

| Parameters ||
|---|---|
| `kx` | `float` <br /> |
| `ky` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### postTranslate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean postTranslate (float dx, 
                float dy)
```

Postconcats the matrix with the specified translation. M' = T(dx, dy) \* M

<br />

| Parameters ||
|---|---|
| `dx` | `float` <br /> |
| `dy` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### preConcat

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean preConcat (Matrix other)
```

Preconcats the matrix with the specified matrix. M' = M \* other

<br />

| Parameters ||
|---|---|
| `other` | `Matrix` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### preRotate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean preRotate (float degrees)
```

Preconcats the matrix with the specified rotation. M' = M \* R(degrees)

<br />

| Parameters ||
|---|---|
| `degrees` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### preRotate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean preRotate (float degrees, 
                float px, 
                float py)
```

Preconcats the matrix with the specified rotation. M' = M \* R(degrees, px, py)

<br />

| Parameters ||
|---|---|
| `degrees` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### preScale

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean preScale (float sx, 
                float sy)
```

Preconcats the matrix with the specified scale. M' = M \* S(sx, sy)

<br />

| Parameters ||
|---|---|
| `sx` | `float` <br /> |
| `sy` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### preScale

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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)

<br />

| Parameters ||
|---|---|
| `sx` | `float` <br /> |
| `sy` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### preSkew

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean preSkew (float kx, 
                float ky)
```

Preconcats the matrix with the specified skew. M' = M \* K(kx, ky)

<br />

| Parameters ||
|---|---|
| `kx` | `float` <br /> |
| `ky` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### preSkew

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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)

<br />

| Parameters ||
|---|---|
| `kx` | `float` <br /> |
| `ky` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### preTranslate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean preTranslate (float dx, 
                float dy)
```

Preconcats the matrix with the specified translation. M' = M \* T(dx, dy)

<br />

| Parameters ||
|---|---|
| `dx` | `float` <br /> |
| `dy` | `float` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### rectStaysRect

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### reset

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void reset ()
```

Set the matrix to identity

<br />

### set

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void set (Matrix src)
```

(deep) copy the src matrix into this matrix. If src is null, reset this matrix to the
identity matrix.

<br />

| Parameters ||
|---|---|
| `src` | `Matrix` <br /> |

### setConcat

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean setConcat (Matrix a, 
                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 `https://developer.android.com/reference/android/os/Build.VERSION_CODES#GINGERBREAD_MR1` and below, this function returns
true only if the result can be represented. In
`https://developer.android.com/reference/android/os/Build.VERSION_CODES#HONEYCOMB` and above, it always returns true.

<br />

<br />

| Parameters ||
|---|---|
| `a` | `Matrix` <br /> |
| `b` | `Matrix` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### setPolyToPoly

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `src` | `float`: The array of src \[x,y\] pairs (points) <br /> |
| `srcIndex` | `int`: Index of the first pair of src values <br /> |
| `dst` | `float`: The array of dst \[x,y\] pairs (points) <br /> |
| `dstIndex` | `int`: Index of the first pair of dst values <br /> |
| `pointCount` | `int`: The number of pairs/points to be used. Must be \[0..4\] <br /> |

| Returns ||
|---|---|
| `boolean` | true if the matrix was set to the specified transformation <br /> |

### setRectToRect

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean setRectToRect (RectF src, 
                RectF dst, 
                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 result can be represented.

<br />

| Parameters ||
|---|---|
| `src` | `RectF`: the source rectangle to map from. <br /> |
| `dst` | `RectF`: the destination rectangle to map to. <br /> |
| `stf` | `Matrix.ScaleToFit`: the ScaleToFit option <br /> |

| Returns ||
|---|---|
| `boolean` | true if the matrix can be represented by the rectangle mapping. <br /> |

### setRotate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `degrees` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

### setRotate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setRotate (float degrees)
```

Set the matrix to rotate about (0,0) by the specified number of degrees.

<br />

| Parameters ||
|---|---|
| `degrees` | `float` <br /> |

### setScale

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setScale (float sx, 
                float sy)
```

Set the matrix to scale by sx and sy.

<br />

| Parameters ||
|---|---|
| `sx` | `float` <br /> |
| `sy` | `float` <br /> |

### setScale

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `sx` | `float` <br /> |
| `sy` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

### setSinCos

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `sinValue` | `float` <br /> |
| `cosValue` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

### setSinCos

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setSinCos (float sinValue, 
                float cosValue)
```

Set the matrix to rotate by the specified sine and cosine values.

<br />

| Parameters ||
|---|---|
| `sinValue` | `float` <br /> |
| `cosValue` | `float` <br /> |

### setSkew

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setSkew (float kx, 
                float ky)
```

Set the matrix to skew by sx and sy.

<br />

| Parameters ||
|---|---|
| `kx` | `float` <br /> |
| `ky` | `float` <br /> |

### setSkew

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `kx` | `float` <br /> |
| `ky` | `float` <br /> |
| `px` | `float` <br /> |
| `py` | `float` <br /> |

### setTranslate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setTranslate (float dx, 
                float dy)
```

Set the matrix to translate by (dx, dy).

<br />

| Parameters ||
|---|---|
| `dx` | `float` <br /> |
| `dy` | `float` <br /> |

### setValues

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `values` | `float` <br /> |

### toShortString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toShortString ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### toString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |