Note that there are some explanatory texts on larger screens.

plurals
  1. POImage shear in WPF
    primarykey
    data
    text
    <p>I am trying to shear an Image in WPF (C#) using pure XAML. I have used transformations such as skew, scale and matrix but I am not getting the result as I want. Following is the code I am using</p> <pre><code> &lt;Image Source="G:\Demo\virtualization\virtualization\img3.bmp" Stretch="Fill" Height="70" Width="240" Margin="0,170,-312,-29" &gt; &lt;Image.RenderTransform&gt; &lt;TransformGroup&gt; &lt;MatrixTransform Matrix="1,.1,-4.2,1,0,0" /&gt; &lt;!--&lt;ScaleTransform ScaleX=".2" ScaleY=".6"/&gt;--&gt; &lt;/TransformGroup&gt; &lt;/Image.RenderTransform&gt; &lt;/Image&gt; </code></pre> <p>With the above code, below is the similar effect that I am getting:</p> <pre><code> /----/ / / / / /----/ </code></pre> <p>But I want following effect:</p> <pre><code> /---\ / \ / \ /---------\ </code></pre> <p>Due to new user, I am not allowed to post Images right now...</p> <p>Thanks</p> <p><em><strong>EDIT:</em></strong></p> <p>I have tried viewport3d to get this effect. Following is the code:</p> <pre><code>&lt;Grid&gt; &lt;Image Source="G:\Demo\virtualization\virtualization\2.jpg"/&gt; &lt;Viewport3D Name="mainViewport" ClipToBounds="True" HorizontalAlignment="Stretch" Height="300"&gt; &lt;Viewport3D.Camera&gt; &lt;PerspectiveCamera Position="0, 0, 20" /&gt; &lt;/Viewport3D.Camera&gt; &lt;Viewport2DVisual3D&gt; &lt;Viewport2DVisual3D.Transform&gt; &lt;MatrixTransform3D Matrix="1,0,0,0 0,1,0,0 0,0,1,0 0,0,0,1" /&gt; &lt;/Viewport2DVisual3D.Transform&gt; &lt;Viewport2DVisual3D.Geometry&gt; &lt;MeshGeometry3D Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0" TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/&gt; &lt;/Viewport2DVisual3D.Geometry&gt; &lt;Viewport2DVisual3D.Material&gt; &lt;DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/&gt; &lt;/Viewport2DVisual3D.Material&gt; &lt;Grid&gt; &lt;Image Source="G:\Demo\virtualization\virtualization\img3.bmp"/&gt; &lt;/Grid&gt; &lt;/Viewport2DVisual3D&gt; &lt;ModelVisual3D&gt; &lt;ModelVisual3D.Content&gt; &lt;DirectionalLight Color="#FFFFFFFF" Direction="0,-1,-1"/&gt; &lt;/ModelVisual3D.Content&gt; &lt;/ModelVisual3D&gt; &lt;/Viewport3D&gt; &lt;/Grid&gt; </code></pre> <p>I am using matrix transformation to get the effect. However I am looking to alternate ways to get this effect May be rotating the camera of viewport.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload