O'Reilly logo

WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 20. Transformations and Effects

As is mentioned in Chapter 1, WPF uses DirectX as its rendering engine. DirectX provides access to any high-performance graphics hardware available on the system, so it can produce amazing effects relatively quickly and easily.

This chapter looks at two useful techniques that WPF gets as a benefit of using DirectX: transformations and bitmap effects. Judicial use of these can make an application easier to use and more attractive.

Transformations

A transformation alters an object's geometry before it is drawn. Different kinds of transformations stretch, rotate, squash, skew, and move an object.

Internally WPF represents transformations using 3-by-3 matrices and manipulates them with linear algebra. Fortunately, you don't need to understand how transformations work to use them in your XAML code.

WPF provides four basic kinds of transformations represented by the following XAML elements:

  • RotateTransform — This transformation rotates an object. The Angle property determines the number of degrees by which the object is rotated clockwise.

  • ScaleTransform — This transformation scales the object vertically and horizontally. The ScaleX and ScaleY properties determine the horizontal and vertical scale factors respectively.

  • SkewTransform — This transformation skews the object by rotating its X and Y axes through an angle given by the AngleX and AngleY properties.

  • TranslateTransform — This transformation moves the object. The X and Y properties determine how far ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required