# Matrix Class

## Definition

Important

Some information relates to prerelease product that may be substantially modified before itâ€™s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

```
[Android.Runtime.Register("android/graphics/Matrix", DoNotGenerateAcw=true)]
public class Matrix : Java.Lang.Object
```

```
[<Android.Runtime.Register("android/graphics/Matrix", DoNotGenerateAcw=true)>]
type Matrix = class
inherit Object
```

- Inheritance

- Attributes

## Remarks

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

Java documentation for `android.graphics.Matrix`

.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

## Constructors

Matrix() |
Create an identity matrix |

Matrix(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |

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

## Fields

Mpersp0 | |

Mpersp1 | |

Mpersp2 | |

MscaleX | |

MscaleY | |

MskewX | |

MskewY | |

MtransX | |

MtransY |

## Properties

Class |
Returns the runtime class of this |

Handle |
The handle to the underlying Android instance. (Inherited from Object) |

IdentityMatrix |
The identity matrix. |

IsAffine |
Gets whether this matrix is affine. |

IsIdentity |
Returns true if the matrix is identity. |

JniIdentityHashCode | (Inherited from Object) |

JniPeerMembers | |

PeerReference | (Inherited from Object) |

ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |

ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |

## Methods

Clone() |
Creates and returns a copy of this object. (Inherited from Object) |

Dispose() | (Inherited from Object) |

Dispose(Boolean) | (Inherited from Object) |

Dump(PrintWriter) |
Dumps a human-readable shortened string of the matrix into the given stream |

Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |

GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |

GetValues(Single[]) |
Copy 9 values from the matrix into the array. |

Invert(Matrix) |
If this matrix can be inverted, return true and if inverse is not null, set inverse to be the inverse of this matrix. |

JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |

MapPoints(Single[]) |
Apply this matrix to the array of 2D points, and write the transformed points back into the array |

MapPoints(Single[], Int32, Single[], Int32, Int32) |
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. |

MapPoints(Single[], Single[]) |
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. |

MapRadius(Single) |
Return the mean radius of a circle after it has been mapped by this matrix. |

MapRect(RectF) |
Apply this matrix to the rectangle, and write the transformed rectangle back into it. |

MapRect(RectF, RectF) |
Apply this matrix to the src rectangle, and write the transformed rectangle into dst. |

MapVectors(Single[]) |
Apply this matrix to the array of 2D vectors, and write the transformed vectors back into the array. |

MapVectors(Single[], Int32, Single[], Int32, Int32) |
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. |

MapVectors(Single[], Single[]) |
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. |

Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |

NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |

PostConcat(Matrix) |
Postconcats the matrix with the specified matrix. |

PostRotate(Single) |
Postconcats the matrix with the specified rotation. |

PostRotate(Single, Single, Single) |
Postconcats the matrix with the specified rotation. |

PostScale(Single, Single) |
Postconcats the matrix with the specified scale. |

PostScale(Single, Single, Single, Single) |
Postconcats the matrix with the specified scale. |

PostSkew(Single, Single) |
Postconcats the matrix with the specified skew. |

PostSkew(Single, Single, Single, Single) |
Postconcats the matrix with the specified skew. |

PostTranslate(Single, Single) |
Postconcats the matrix with the specified translation. |

PreConcat(Matrix) |
Preconcats the matrix with the specified matrix. |

PreRotate(Single) |
Preconcats the matrix with the specified rotation. |

PreRotate(Single, Single, Single) |
Preconcats the matrix with the specified rotation. |

PreScale(Single, Single) |
Preconcats the matrix with the specified scale. |

PreScale(Single, Single, Single, Single) |
Preconcats the matrix with the specified scale. |

PreSkew(Single, Single) |
Preconcats the matrix with the specified skew. |

PreSkew(Single, Single, Single, Single) |
Preconcats the matrix with the specified skew. |

PreTranslate(Single, Single) |
Preconcats the matrix with the specified translation. |

RectStaysRect() |
Returns true if will map a rectangle to another rectangle. |

Reset() |
Set the matrix to identity |

Set(Matrix) |
(deep) copy the src matrix into this matrix. |

SetConcat(Matrix, Matrix) |
Set the matrix to the concatenation of the two specified matrices and return true. |

SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |

SetPolyToPoly(Single[], Int32, Single[], Int32, Int32) |
Set the matrix such that the specified src points would map to the specified dst points. |

SetRectToRect(RectF, RectF, Matrix+ScaleToFit) |
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. |

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

SetRotate(Single, Single, Single) |
Set the matrix to rotate by the specified number of degrees, with a pivot point at (px, py). |

SetScale(Single, Single) |
Set the matrix to scale by sx and sy. |

SetScale(Single, Single, Single, Single) |
Set the matrix to scale by sx and sy, with a pivot point at (px, py). |

SetSinCos(Single, Single) |
Set the matrix to rotate by the specified sine and cosine values. |

SetSinCos(Single, Single, Single, Single) |
Set the matrix to rotate by the specified sine and cosine values, with a pivot point at (px, py). |

SetSkew(Single, Single) |
Set the matrix to skew by sx and sy. |

SetSkew(Single, Single, Single, Single) |
Set the matrix to skew by sx and sy, with a pivot point at (px, py). |

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

SetValues(Single[]) |
Copy 9 values from the array into the matrix. |

ToArray<T>() | (Inherited from Object) |

ToShortString() | |

ToString() |
Returns a string representation of the object. (Inherited from Object) |

UnregisterFromRuntime() | (Inherited from Object) |

Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |

Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |

Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |

## Explicit Interface Implementations

IJavaPeerable.Disposed() | (Inherited from Object) |

IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |

IJavaPeerable.Finalized() | (Inherited from Object) |

IJavaPeerable.JniManagedPeerState | (Inherited from Object) |

IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |

IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |

IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |

## Extension Methods

JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |

JavaCast<TResult>(IJavaObject) | |

GetJniTypeName(IJavaPeerable) |