GpMatrixOrder enumeration
Selects the order of multiplication when a new transformation is combined with an existing one.
Each transformation method takes an order argument that defaults to MatrixOrderPrepend. The order matters because matrix multiplication does not commute: translating then scaling gives a different result than scaling then translating.
| Member | Value | Description |
|---|---|---|
| MatrixOrderPrepend | 0 | The new transformation is applied before the existing one. The new matrix is the left operand. |
| MatrixOrderAppend | 1 | The new transformation is applied after the existing one. The new matrix is the right operand. |
Used by
- Graphics class: MultiplyTransform, RotateTransform, RotateTransformAt, ScaleTransform, ShearTransform, TranslateTransform
- ITransformable interface: MultiplyTransform, RotateTransform, RotateTransformAt, ScaleTransform, ShearTransform, TranslateTransform
- LinearGradientBrush class: MultiplyTransform, RotateTransform, RotateTransformAt, ScaleTransform, ShearTransform, TranslateTransform
- Matrix class: Multiply, Rotate, RotateAt, Scale, Shear, Translate
- PathGradientBrush class: MultiplyTransform, RotateTransform, RotateTransformAt, ScaleTransform, ShearTransform, TranslateTransform
- Pen class: MultiplyTransform, RotateTransform, ScaleTransform, TranslateTransform
- TextureBrush class: MultiplyTransform, RotateTransform, RotateTransformAt, ScaleTransform, ShearTransform, TranslateTransform
Example
Dim user As GdiPlusUser = GdiPlusUser()
' Translate by (10, 20), then scale by (2, 3).
Dim before As Matrix = Matrix()
before.Translate 10, 20
before.Scale 2, 3, MatrixOrderPrepend
Debug.Print before.OffsetX, before.OffsetY
Dim after As Matrix = Matrix()
after.Translate 10, 20
after.Scale 2, 3, MatrixOrderAppend
Debug.Print after.OffsetX, after.OffsetY
' Output:
' 10 20
' 20 60
With MatrixOrderPrepend the scaling is applied to a point before the translation, so the translation is unchanged. With MatrixOrderAppend the scaling is applied after the translation, so it scales the offset too.
See Also
- MatrixOrder – Microsoft’s documentation of the GDI+ enumeration
- Enumerations – all the enumerations of the package
- Graphics class
- ITransformable interface
- LinearGradientBrush class
- Matrix class