Skewing In 2-D Transformation Using Windows Store Apps


The operations of 2-D Transformation includes Rotation, Scaling, Skewing and Translate. Today I am going to explain the Skewing operation of this 2-D Transformation. In all of these four the skew is probably the trickiest to understand, since its values (in degrees) don't appear to apply in the ways that one might expect. The easiest way to consider skew is to think of the values as "pulling" on opposite sides of the element box to create the angle specified. In order to see how it works let's use the following steps.

Step 1

First you have to open Visual Studio 2012 and then select File -> New -> project. A window is shown; in that window select Windows Store inside the Visual C# from the left pane and then select BlankPage from the center pane then give a name for your application, for eample I used the name "Skewing1", then click ok.


Step 2

Add the image to your application in which you apply the skewing operation.

Step 3

Open the MainPage.xaml file and write the code in this as:











            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

                <GradientStop Color="Black"/>

                <GradientStop Color="#FF4DAACD" Offset="1"/>




            <RowDefinition Height="50"/>

            <RowDefinition Height="50"/>

            <RowDefinition Height="50"/>

            <RowDefinition Height="50"/>



            <ColumnDefinition Width="150"/>

            <ColumnDefinition Width="200"/>


        <TextBlock Text="Skewing In 2-D Transformation" FontSize="30" Margin="10,10,-300,0" Grid.Row="0" Grid.Column="1"/>

        <TextBlock Text="SkewX" Grid.Row="1" Grid.Column="0" Margin="10,10,0,0" FontSize="20"/>

        <Slider Name="SkewX" Grid.Row="1" Grid.Column="1" Margin="10,0,0,0" Width="200"  Minimum="0"  Maximum="300" Value="{Binding ElementName=Skewing, Path=SkewX, Mode=TwoWay}"/>

        <TextBlock Text="SkewY" Grid.Row="2" Grid.Column="0" FontSize="20" Margin="10,10,0,0"/>

        <Slider Name="SkewY" Grid.Row="2" Grid.Column="1" Margin="10,0,0,0" Width="200"  Minimum="0" Maximum="300" Value="{Binding ElementName=Skewing, Path=SkewY, Mode=TwoWay}"/>

        <Image Source="Dotnet_framework.jpg" Opacity="0.3" Grid.Row="3" Grid.Column="1" Margin="70,91,-197,-236" />

        <Image Source="Dotnet_framework.jpg" Grid.Row="3" Grid.Column="1" Margin="70,91,-197,-236" >


                <CompositeTransform x:Name="Skewing"/>





Step 4

Now Run the application by pressing F5; you will see the result as:


When I apply the Skew operation in the X-axis the image looks like:


When move the silder to change the value of Y-axis it will look like:


In both X and Y axes the image looks like when I change both the values of the sliders.



In this article I explained how to use the skewing operation of 2-D-Transformation using Windows Store apps.


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now