#789 – How a Scale Transform Works

A 2D scale transform in WPF is accomplished by using a transformation matrix.  The transformation matrix is multiplied by another matrix representing a single 2D point to be transformed.  The resulting matrix describes the transformed point.  When scaling a user interface element, this transformation is done individually on each point to generate the set of points representing the transformed element.

The transformation operation for scaling looks like:

789-001

Where Sx and Sy represent the ScaleX and ScaleY properties of the ScaleTransform, respectively.

This leads to the equations:

789-002

Advertisements