Ugrás a tartalomhoz

.NET Programming Technologies

Gergely Kovásznai, Csaba Biró

Eszterházy Károly College

MatrixTransform

MatrixTransform

You can create unique transformation with using MatrixTransform, for which the previously known classes (RotateTransform, SkewTransform, ScaleTransform, TranslateTransform) are not suitable. The connected chapters of ’Kovács, Hernyák, Radvány & Király 2005’ is offered to get acquainted with the theoretical background of matrix transformations.

A Transzformációs mátrix elemei:

M11        transformation matrix (1,1) element value,

M12        transformation matrix (1,2) element value,

M21        transformation matrix (2,1) element value,

M22        transformation matrix (2,2) element value,

OffsetX        transformation matrix (3,1) element value,

OffsetY        transformation matrix (3,2) element value.

The matrix used by WPF has the following structure:

M11

M12

0

M21

M22

0

OffsetX

OffsetY

1

As in the case of an affine transformation matrix, the last column value is (0,0,1), so we only need to define the first two column elements.

Example VIII.4 MatrixTransform

VIII.5. MatrixTransform

<Image Width="90" Height="60" Source="car.jpg">

         <Image.RenderTransform>

              <MatrixTransform>

                 <MatrixTransform.Matrix>

                           <Matrix OffsetX="10" OffsetY="1" M11="3" M12="2"/>

                  </MatrixTransform.Matrix>

              </MatrixTransform>

         </Image.RenderTransform>

</Image>