Welcome to Windows Presentation Foundation (WPF)
Top Tasks :

WPF Community Bloggers

Non-Affine Transforms in 2D?

A recent query on the MSDN Forum for WPF asked if it's possible to apply a non-affine transform to two-dimensional graphics. The simple answer is No . The 3×3 Matrix structure in the System.Windows.Media namespace does not allow setting the third column of the matrix required for non-affine transforms. However, non-affine transforms are allowed in WPF 3D and, indeed, you might be able to get the effect you want without getting involved with transforms at all. The two programs presented here both display a photo of myself in a square. Using the mouse, you can grab any one of the corners and drag it. You must click within the image! The nearest corner will jump to the mouse position and then you can drag the corner somewhere else. As you drag a corner, the other corners remain fixed. Here's the first version: NonAffineImageTransform1.xbap This is the simple approach: It uses WPF 3D to display a square on the XY plane. The 3D coordinates defined in the Positions collection of the MeshGeometry3D Read More...
Published Saturday, August 25, 2007 2:38 PM by Charles Petzold
Filed under:

Comments

No Comments
Anonymous comments are disabled

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us