MatrixTransform Transformation : MatrixTransform « Graphics « Silverlight






MatrixTransform Transformation

MatrixTransform Transformation
 
<?xml version="1.0" encoding="iso-8859-1"?>

<UserControl x:Class='SilverlightApplication3.MainPage'
    xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
    xmlns:d='http://schemas.microsoft.com/expression/blend/2008' 
    xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006' 
    mc:Ignorable='d' 
    d:DesignWidth='640' 
    d:DesignHeight='480'>
    
    <Canvas xmlns="http://schemas.microsoft.com/client/2007"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
       <Rectangle Width="200" Height="100" Opacity=".5"
                  Canvas.Left="10" Canvas.Top="10"
                  Fill="Red" Stroke="Blue"
                  StrokeThickness="2">
       </Rectangle>
    
       <Rectangle Width="200" Height="100" Opacity=".5"
                  Canvas.Left="50" Canvas.Top="10"
                  Fill="Blue" Stroke="Red"
                  StrokeThickness="2">
          <Rectangle.RenderTransform>
           <MatrixTransform>
            <MatrixTransform.Matrix>
              <Matrix M11="0.866" M12="0.5"
                      M21="-0.5"   M22="0.866"/>
            </MatrixTransform.Matrix>
           </MatrixTransform>
         </Rectangle.RenderTransform>
       </Rectangle>
    
       <Rectangle Width="200" Height="100" Opacity=".5"
                  Canvas.Left="50" Canvas.Top="10"
                  Fill="Orange" Stroke="Black"
                  StrokeThickness="2">
          <Rectangle.RenderTransform>
           <MatrixTransform>
            <MatrixTransform.Matrix>
              <Matrix M11="1"     M12="0.5"
                      M21="0.5" M22="1"/>
            </MatrixTransform.Matrix>
           </MatrixTransform>
         </Rectangle.RenderTransform>
       </Rectangle>
    </Canvas>

</UserControl>

   
  








Related examples in the same category