Leadtools.Windows.Media.Effects Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.02.15
FlipCommandBitmapEffect Class
See Also  Members   Example 
Leadtools.Windows.Media.Effects Namespace : FlipCommandBitmapEffect Class





Flips the image from top to bottom or from left to right.

Syntax

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

FlipCommandBitmapEffect ...

Example

This example will load an image then flip it before saving it back to disk.

Visual BasicCopy Code
Public Sub FlipCommandBitmapEffectExample(ByVal element As FrameworkElement)

   ' Initialize Effect
   Dim effect As FlipCommandBitmapEffect = New FlipCommandBitmapEffect()
   effect.Horizontal = True
   element.BitmapEffect = effect

   ' Initialize Animations
   Dim animation1 As BooleanAnimationUsingKeyFrames = New BooleanAnimationUsingKeyFrames()
   animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(False, KeyTime.FromTimeSpan(New TimeSpan(0))))
   animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(True, KeyTime.FromTimeSpan(New TimeSpan(10000000))))
   animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(False, KeyTime.FromTimeSpan(New TimeSpan(20000000))))
   animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(True, KeyTime.FromTimeSpan(New TimeSpan(30000000))))
   animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(False, KeyTime.FromTimeSpan(New TimeSpan(35000000))))
   animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(True, KeyTime.FromTimeSpan(New TimeSpan(40000000))))

   ' Initialize and run Storyboard
   Dim storyboard As Storyboard = New Storyboard()
   storyboard.SetTargetName(animation1, "AnimatedBitmapEffect")
   storyboard.SetTargetProperty(animation1, New PropertyPath(FlipCommandBitmapEffect.HorizontalProperty))
   element.RegisterName("AnimatedBitmapEffect", effect)
   storyboard.Children.Add(animation1)

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

 
   // Initialize Effect 
   FlipCommandBitmapEffect effect = new FlipCommandBitmapEffect(); 
   effect.Horizontal = true; 
   element.BitmapEffect = effect; 
 
   // Initialize Animations 
   BooleanAnimationUsingKeyFrames animation1 = new BooleanAnimationUsingKeyFrames(); 
   animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(false, KeyTime.FromTimeSpan(new TimeSpan(0)))); 
   animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(true, KeyTime.FromTimeSpan(new TimeSpan(10000000)))); 
   animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(false, KeyTime.FromTimeSpan(new TimeSpan(20000000)))); 
   animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(true, KeyTime.FromTimeSpan(new TimeSpan(30000000)))); 
   animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(false, KeyTime.FromTimeSpan(new TimeSpan(35000000)))); 
   animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(true, KeyTime.FromTimeSpan(new TimeSpan(40000000)))); 
 
   // Initialize and run Storyboard 
   Storyboard storyboard = new Storyboard(); 
   Storyboard.SetTargetName(animation1, "AnimatedBitmapEffect"); 
   Storyboard.SetTargetProperty(animation1, new PropertyPath(FlipCommandBitmapEffect.HorizontalProperty)); 
   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;assembly=Leadtools.Windows.Media.Effects"> 
  <Grid> 
    <Image Margin="10,10,10,10" HorizontalAlignment="Center" VerticalAlignment="Center" Source="C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 15\Images\slave.jpg"> 
      <Image.BitmapEffect> 
        <lteffects:FlipCommandBitmapEffect x:Name="MyBitmapEffect" /> 
      </Image.BitmapEffect> 
      <Image.Triggers> 
        <EventTrigger RoutedEvent="Image.Loaded"> 
          <BeginStoryboard> 
            <Storyboard> 
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="MyBitmapEffect" Storyboard.TargetProperty="Horizontal" Duration="0:0:4" FillBehavior="HoldEnd"> 
                <DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:0" /> 
                <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:1" /> 
                <DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:2" /> 
                <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:3" /> 
                <DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:3.5" /> 
                <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:4" /> 
              </BooleanAnimationUsingKeyFrames> 
            </Storyboard> 
          </BeginStoryboard> 
        </EventTrigger> 
      </Image.Triggers> 
    </Image> 
  </Grid> 
</Page>

Remarks

This command can flip an image from top to bottom (vertically) or from left to right (horizontally).

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.FlipCommandBitmapEffect

Requirements

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

See Also