Leadtools.Windows.Media.Effects Send comments on this topic. | Back to Introduction - LEADTOOLS WPF | Help Version 16.5.9.25
PerspectiveCommandBitmapEffect Class
See Also  Members   Example 
Leadtools.Windows.Media.Effects.SpecialEffects Namespace : PerspectiveCommandBitmapEffect Class





Gives the image a 3-D depth, as if it exists on a flat plane skewed into different shapes.

Syntax

Visual Basic (Declaration) 
Public Class PerspectiveCommandBitmapEffect 
   Inherits RasterCommandBitmapEffect
Visual Basic (Usage)Copy Code
Dim instance As PerspectiveCommandBitmapEffect
C# 
public class PerspectiveCommandBitmapEffect : RasterCommandBitmapEffect 
C++/CLI 
public ref class PerspectiveCommandBitmapEffect : public RasterCommandBitmapEffect 
XAML Property Element Usage 

PerspectiveCommandBitmapEffect ...

XAML Property Element Usage 

PerspectiveCommandBitmapEffect ...

Example

Run the PerspectiveCommandBitmapEffect on an image.

Visual BasicCopy Code
Public Sub PerspectiveCommandBitmapEffectExample(ByVal element As FrameworkElement)
   Dim effect As PerspectiveCommandBitmapEffect = New PerspectiveCommandBitmapEffect()
   Dim corners As System.Windows.Point() = New System.Windows.Point(3) {}

   corners(0) = New System.Windows.Point(0, 0)
   corners(1) = New System.Windows.Point(300, 0)
   corners(2) = New System.Windows.Point(0, 391)
   corners(3) = New System.Windows.Point(300, 391)

   effect.CornerPoints = corners
   effect.FillColor = Color.FromRgb(255, 255, 255)
   effect.Type = PerspectiveCommandBitmapEffectsType.Color
   element.BitmapEffect = effect

   Dim storyboard As Storyboard = New Storyboard()

   Dim animation1 As ColorAnimation = New ColorAnimation()
   animation1.From = Color.FromRgb(255, 0, 0)
   animation1.To = Color.FromRgb(0, 0, 255)
   animation1.By = Color.FromRgb(1, 1, 1)
   animation1.Duration = New Duration(TimeSpan.Parse("0:0:2"))
   animation1.RepeatBehavior = RepeatBehavior.Forever
   animation1.AutoReverse = True

   storyboard.SetTargetName(animation1, "AnimatedBitmapEffect")
   storyboard.SetTargetProperty(animation1, New PropertyPath(PerspectiveCommandBitmapEffect.FillColorProperty))
   element.RegisterName("AnimatedBitmapEffect", effect)
   storyboard.Children.Add(animation1)

   storyboard.Begin(element)
End Sub
C#Copy Code
public void PerspectiveCommandBitmapEffectExample(FrameworkElement element) 

   PerspectiveCommandBitmapEffect effect = new PerspectiveCommandBitmapEffect(); 
   Point[] corners = new Point[4]; 
 
   corners[0] = new Point(0, 0); 
   corners[1] = new Point(300, 0); 
   corners[2] = new Point(0, 391); 
   corners[3] = new Point(300, 391); 
 
   effect.CornerPoints = corners; 
   effect.FillColor = Color.FromRgb(255, 255, 255); 
   effect.Type = PerspectiveCommandBitmapEffectsType.Color; 
   element.BitmapEffect = effect; 
 
   Storyboard storyboard = new Storyboard(); 
 
   // Initialize Animations 
   ColorAnimation animation1 = new ColorAnimation(); 
   animation1.From = Color.FromRgb(255, 0, 0); 
   animation1.To = Color.FromRgb(0, 0, 255); 
   animation1.By = Color.FromRgb(1, 1, 1); 
   animation1.Duration = new Duration(TimeSpan.Parse("0:0:2")); 
   animation1.RepeatBehavior = RepeatBehavior.Forever; 
   animation1.AutoReverse = true; 
 
   Storyboard.SetTargetName(animation1, "AnimatedBitmapEffect"); 
   Storyboard.SetTargetProperty(animation1, new PropertyPath(PerspectiveCommandBitmapEffect.FillColorProperty)); 
   element.RegisterName("AnimatedBitmapEffect", effect); 
   storyboard.Children.Add(animation1); 
 
   storyboard.Begin(element); 
}
XAMLCopy Code
<Page Title="CSAnimateEffect" Height="391" Width="300" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:lteffects="clr-namespace:Leadtools.Windows.Media.Effects.SpecialEffects;assembly=Leadtools.Windows.Media.Effects"> 
  <Grid> 
    <Image Margin="10,10,10,10" HorizontalAlignment="Center" VerticalAlignment="Center" Source="C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 16\Images\slave.jpg"> 
      <Image.BitmapEffect> 
        <lteffects:PerspectiveCommandBitmapEffect x:Name="AnimatedBitmapEffect" FillColor="White" Type="Color" /> 
        <lteffects:PerspectiveCommandBitmapEffect.CornerPoints> 
          <x:Array Type="Point"> 
            <Point X="0" Y="0" /> 
            <Point X="300" Y="0" /> 
            <Point X="0" Y="391" /> 
            <Point X="300" Y="391" /> 
          </x:Array> 
        </lteffects:PerspectiveCommandBitmapEffect.CornerPoints> 
      </Image.BitmapEffect> 
      <Image.Triggers> 
        <EventTrigger RoutedEvent="Image.Loaded"> 
          <BeginStoryboard></BeginStoryboard> 
        </EventTrigger> 
      </Image.Triggers> 
    </Image> 
  </Grid> 
</Page>

Remarks

  • This command does not support signed data images.

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.Freezable
            System.Windows.Media.Animation.Animatable
               System.Windows.Media.Effects.BitmapEffect
                  Leadtools.Windows.Media.Effects.RasterCommandBitmapEffect
                     Leadtools.Windows.Media.Effects.SpecialEffects.PerspectiveCommandBitmapEffect

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, Windows Server 2003 family, Windows Server 2008 family

See Also