MatrixTransform

The MatrixTransform creates an arbitrary affine matrix transformation that is used to manipulate objects or coordinate systems in a two-dimensional plane. Use a MatrixTransform to create custom transformations that are not provided by the RotateTransform, ScaleTransform, SkewTransform, and TranslateTransform classes.

A two-dimensional x-y plane uses a 3 x 3 matrix for transformations. You can multiply affine matrix transformations to form linear transformations, such as rotation and skew (shear) transformations that are followed by translation.

An affine matrix transformation has its final column equal to (0, 0, 1); therefore, you only have to specify the members in the first two columns.

The members in the last row, OffsetX and OffsetY, represent translation values.

 

Methods and properties usually specify the transformation matrix as a vector that has only six members; the members are as follows: (M11, M12, M21, M22, OffsetX, OffsetY).

Values include:

      m11: The value at position (1, 1) of the transformation Matrix.

      m12: The value at position (1, 2) of the transformation Matrix.

      m21: The value at position (2, 1) of the transformation Matrix.

      m22: The value at position (2, 2) of the transformation Matrix.

      offsetX: The value at position (3, 1) of the transformation Matrix.

      offsetY: The value at position (3, 2) of the transformation Matrix.

For example:

<c1:C1LayoutTransformer >

    <c1:C1LayoutTransformer.LayoutTransform>

        <MatrixTransform >

            <MatrixTransform.Matrix >

            <Matrix M11="-1" M12="1" M21="-1" M22="-2"/>

            </MatrixTransform.Matrix>

        </MatrixTransform>

    </c1:C1LayoutTransformer.LayoutTransform>

    <Button Background="MediumPurple" Content="Matrix" Height="80" Width="180" VerticalAlignment="Top" HorizontalAlignment="Right"/>

</c1:C1LayoutTransformer>

Multiple transforms can be applied with a TransformGroup.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.