Skewing an element while rendering
SkewTransform
is used in a WPF platform to shear an element so that it has a 3D look in a 2D plate by adding depth to it. The AngleX
and AngleY
properties are used to specify the skew angle of the X axis and the Y axis, while the CenterX
and CenterY
properties are used to specify the X and Y coordinates of the center point.
In this recipe, we will learn how to apply skew transform to an image.
Getting ready
To get started, open your Visual Studio IDE and create a new project named CH08.SkewTransformDemo
, based on the WPF application template.
How to do it...
Let's add some images to the application window and apply skew to those at a certain angle and certain center positions. Follow these steps:
- From
Solution Explorer
, right-click on the project node and create a new folder. Name itImages
. - Now right-click on the
Images
folder and add an existing image from your system. Name it asimage1.png
. - Open the
MainWindow.xaml
file and replace the existingGrid
with a horizontal...