次の方法で共有


IXRMatrixTransform (Compact 2013)

3/28/2014

This class creates an affine matrix transformation that is used to manipulate UI objects or coordinate systems in a two-dimensional plane.

Syntax

class IXRMatrixTransform : public IXRTransform

Inheritance Hierarchy

IXRDependencyObject

    IXRGeneralTransform

        IXRTransform

            IXRMatrixTransform

Methods

Method

Description

IXRMatrixTransform::GetMatrix

Retrieves the matrix that defines this transformation.

IXRMatrixTransform::SetMatrix

Sets the matrix that defines this transformation.

Thread Safety

Members of this class are thread-safe if you previously called IXRApplication::CreateHostFromXaml and supplied it with an XRWindowCreateParams structure that has AllowsMultipleThreadAccess set to true.

Remarks

You can use an IXRMatrixTransform object to create custom transformations that are not provided by the IXRRotateTransform, IXRScaleTransform, IXRSkewTransform, and IXRTranslateTransform classes.

A two-dimensional x-y plane uses a cubic (3 × 3) matrix for transformations. You can form linear transformations, such as rotation and skew (shear) transformations, by multiplying affine matrix transformations followed by positioning translation.

The final column of an affine matrix transformation is equal to (0, 0, 1). Therefore, you have to define only the members in the first two columns, which equates to four 4 flexible quadrants, and set the x-y offset.

For more information about the custom transformation, see IXRMatrix.

You can offset the local (0,0) position for a UI object on an IXRCanvas container object by setting its attached properties Canvas.Left and Canvas.Top. However, this does not operate as a transform and the object still keeps its own local (0,0) position.

Multiple transformations can be applied to an object by using IXRTransformGroup. Depending on the matrix math you create, even multiple matrix transformations are possible.

To apply a matrix transformation to a UI object, create an IXRMatrixTransform instance and apply it to the object by passing it into the inherited method IXRUIElement::SetRenderTransform.

IXRMatrixTransform is for custom transformations. It is usually easier to use the specific transformations IXRRotateTransform, IXRScaleTransform, IXRSkewTransform, or IXRTranslateTransform.

When you create a class instance, use an IXRMatrixTransformPtr smart pointer instead of a raw interface pointer. For more information, see XRPtr<Interface>.

You can also define a matrix transformation in Microsoft Silverlight 3 XAML. For information about the differences between XAML in XAML for Windows Embedded and Silverlight 3, see Differences Between Microsoft Silverlight 3 and XAML for Windows Embedded. For more information about how to define this element in the source XAML for your application, see the MatrixTransform Class on MSDN.

.NET Framework Equivalent

System.Windows.Media.MatrixTransform

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for Visual Appearance