---
title: "TransformsProvider..::.ApplyMatrixTransform Method (Matrix)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_TransformsProvider_ApplyMatrixTransform_1_05ab20fe.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# TransformsProvider.ApplyMatrixTransform Method (Matrix)
 
Applies a linear transformation of the bitmap (based on specified matrix).
 
**Namespace:** [Aurigma.GraphicsMill](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public Sub ApplyMatrixTransform ( _transform As Matrix _
)
```
 
```csharp
public void ApplyMatrixTransform(Matrix transform
)
```
 
### Parameters
 
 - transform
     - Type: [Aurigma.GraphicsMill.Transforms.Matrix](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_Matrix.htm.md)
 [Matrix](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_Matrix.htm.md) class instance which specifies a matrix of the linear transformation.
 
## Remarks
 You can also use [ApplyMatrixTransform](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_ApplyMatrixTransform.htm.md) class to apply this effect.
 
## Examples
  
Here is an example how to apply skew transform using the affine matrix:
 
```
Dim matrix As New Aurigma.GraphicsMill.Transforms.Matrix
'0 1 2
matrix.Elements(0) = 1.0F
matrix.Elements(1) = 0.0F
matrix.Elements(2) = 0.0F

'3 4 5
matrix.Elements(3) = 0.0F
matrix.Elements(4) = 0.3F
matrix.Elements(5) = 0.0F

'6 7 8
matrix.Elements(6) = 0.0F
matrix.Elements(7) = 0.0F
matrix.Elements(8) = 1.0F

bitmap.Transforms.ApplyMatrixTransform(matrix)
```
 
```csharp
Aurigma.GraphicsMill.Transforms.Matrix matrix = 
    new Aurigma.GraphicsMill.Transforms.Matrix();
//0 1 2
matrix.Elements[0] = 1.0F;
matrix.Elements[1] = 0.0F;
matrix.Elements[2] = 0.0F;

//3 4 5
matrix.Elements[3] = 0.0F;
matrix.Elements[4] = 0.3F;
matrix.Elements[5] = 0.0F;

//6 7 8
matrix.Elements[6] = 0.0F;
matrix.Elements[7] = 0.0F;
matrix.Elements[8] = 1.0F;

bitmap.Transforms.ApplyMatrixTransform(matrix);
```
 
Here is an example of the skew transform using points:
 
```
Dim horizontalOffset As Integer = 20
Dim verticalOffset As Integer = 40

Dim sourcePoints As PointF() = New PointF() { _
 New PointF(0.0F, 0.0F), _
 New PointF(bitmap.Width - 1, 0.0F), _
 New PointF(0.0F, bitmap.Height - 1)}

Dim destinationPoints As PointF() = New PointF() { _
 New PointF(0.0F, 0.0F), _
 New PointF(bitmap.Width - 1, verticalOffset), _
 New PointF(horizontalOffset, bitmap.Height - 1)}

Dim matrix As Aurigma.GraphicsMill.Transforms.Matrix = _
 Aurigma.GraphicsMill.Transforms.Matrix.FromAffinePoints(sourcePoints, destinationPoints)

bitmap.Transforms.ApplyMatrixTransform(matrix)
```
 
```csharp
int horizontalOffset = 20;
int verticalOffset = 40;

PointF[] sourcePoints = new PointF[]{
    new PointF(0.0F, 0.0F), 
    new PointF(bitmap.Width - 1, 0.0F),
    new PointF(0.0F, bitmap.Height - 1)};

PointF[] destinationPoints = new PointF[]{
    new PointF(0, 0),
    new PointF(bitmap.Width - 1, verticalOffset),
    new PointF(horizontalOffset, bitmap.Height - 1)};

Aurigma.GraphicsMill.Transforms.Matrix matrix =
    Aurigma.GraphicsMill.Transforms.Matrix.FromAffinePoints(sourcePoints, destinationPoints);

bitmap.Transforms.ApplyMatrixTransform(matrix);
```
 
Here are examples with projective matrix:
 
```
Dim matrix As New Aurigma.GraphicsMill.Transforms.Matrix
'0 1 2
matrix.Elements(0) = 1.0F
matrix.Elements(1) = 0.0F
matrix.Elements(2) = 0.0F

'3 4 5
matrix.Elements(3) = 0.0F
matrix.Elements(4) = 0.9F
matrix.Elements(5) = 0.001F

'6 7 8
matrix.Elements(6) = 0.0F
matrix.Elements(7) = 0.01F
matrix.Elements(8) = 1.0F

bitmap.Transforms.ApplyMatrixTransform(matrix)
```
 
```csharp
Aurigma.GraphicsMill.Transforms.Matrix matrix = 
    new Aurigma.GraphicsMill.Transforms.Matrix();
//0 1 2
matrix.Elements[0] = 1.0F;
matrix.Elements[1] = 0.0F;
matrix.Elements[2] = 0.0F;

//3 4 5
matrix.Elements[3] = 0.0F;
matrix.Elements[4] = 0.9F;
matrix.Elements[5] = 0.001F;

//6 7 8
matrix.Elements[6] = 0.0F;
matrix.Elements[7] = 0.01F;
matrix.Elements[8] = 1.0F;

bitmap.Transforms.ApplyMatrixTransform(matrix);
```
 
```
Dim offset As Integer = 20

Dim sourcePoints As PointF() = New PointF() { _
 New PointF(0.0F, 0.0F), _
 New PointF(bitmap.Width - 1, 0.0F), _
 New PointF(bitmap.Width - 1, bitmap.Height - 1), _
 New PointF(0.0F, bitmap.Height - 1)}

Dim destinationPoints As PointF() = New PointF() { _
 New PointF(0.0F, 0.0F), _
 New PointF(bitmap.Width - 1, offset), _
 New PointF(bitmap.Width - 1, bitmap.Height - offset - 1), _
 New PointF(0.0F, bitmap.Height - 1)}

Dim matrix As Aurigma.GraphicsMill.Transforms.Matrix = _
 Aurigma.GraphicsMill.Transforms.Matrix.FromProjectivePoints(sourcePoints, destinationPoints)

bitmap.Transforms.ApplyMatrixTransform(matrix)
```
 
```csharp
int offset = 20;

PointF[] sourcePoints = new PointF[]{
    new PointF(0.0F, 0.0F), 
    new PointF(bitmap.Width - 1, 0.0F), 
    new PointF(bitmap.Width - 1, bitmap.Height - 1), 
    new PointF(0.0F, bitmap.Height - 1)};

PointF[] destinationPoints = new PointF[] {
    new PointF(0.0F, 0.0F),
    new PointF(bitmap.Width - 1, offset),
    new PointF(bitmap.Width - 1, bitmap.Height - offset - 1),
    new PointF(0.0F, bitmap.Height - 1)};

Aurigma.GraphicsMill.Transforms.Matrix matrix =
    Aurigma.GraphicsMill.Transforms.Matrix.FromProjectivePoints(sourcePoints, destinationPoints);

bitmap.Transforms.ApplyMatrixTransform(matrix);
```
   
## See Also

### Reference

- [TransformsProvider Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_TransformsProvider.htm.md)
- [ApplyMatrixTransform Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_TransformsProvider_ApplyMatrixTransform.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
