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





Throws colored balls over the image. The resulting color of the ball is a combination of ball color and the color of the pixel where it has fallen with certain opacity. Various parameters control the color and appearance of the balls. This method is available in the Document and Medical toolkits.

Syntax

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

ColoredBallsCommandBitmapEffect ...

Example

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

   ' Initialize Effect
   Dim effect As ColoredBallsCommandBitmapEffect = New ColoredBallsCommandBitmapEffect()
   Dim ballColors As System.Windows.Media.Color() = New System.Windows.Media.Color(3) {}
   ballColors(0) = System.Windows.Media.Color.FromRgb(255, 128, 64)
   ballColors(1) = System.Windows.Media.Color.FromRgb(160, 80, 255)
   ballColors(2) = System.Windows.Media.Color.FromRgb(64, 255, 100)
   ballColors(3) = System.Windows.Media.Color.FromRgb(100, 255, 255)
   effect.NumberOfBalls = 10
   effect.Size = 15
   effect.SizeVariation = 10
   effect.HighLightAngle = 4500
   effect.HighLightColor = System.Windows.Media.Color.FromRgb(255, 255, 255)
   effect.BackGroundColor = System.Windows.Media.Color.FromRgb(255, 0, 0)
   effect.ShadingColor = System.Windows.Media.Color.FromRgb(255, 255, 0)
   effect.Ripple = 200
   effect.BallColorOpacity = 64
   effect.BallColorOpacityVariation = 25
   effect.Flags = ColoredBallsCommandBitmapEffectsFlags.ShadingCircular Or ColoredBallsCommandBitmapEffectsFlags.Sticker Or ColoredBallsCommandBitmapEffectsFlags.BackGroundImage Or ColoredBallsCommandBitmapEffectsFlags.BallsColorOpacity
   effect.BallColors = ballColors
   element.BitmapEffect = effect

   ' Initialize Animations
   Dim animation1 As ColorAnimation = New ColorAnimation()
   animation1.From = Color.FromRgb(0, 0, 0)
   animation1.To = Color.FromRgb(255, 0, 0)
   animation1.By = Color.FromRgb(1, 1, 1)
   animation1.Duration = New Duration(TimeSpan.FromSeconds(1.0))
   animation1.AutoReverse = True
   animation1.RepeatBehavior = RepeatBehavior.Forever
   Dim animation2 As Int32Animation = New Int32Animation()
   animation2.From = 0
   animation2.To = 255
   animation2.By = 1
   animation2.Duration = New Duration(TimeSpan.FromSeconds(3.0))
   animation2.AutoReverse = True
   animation2.RepeatBehavior = RepeatBehavior.Forever

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

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

 
   // Initialize Effect 
   ColoredBallsCommandBitmapEffect effect = new ColoredBallsCommandBitmapEffect(); 
   System.Windows.Media.Color[] ballColors = new System.Windows.Media.Color[4]; 
   ballColors[0] = System.Windows.Media.Color.FromRgb(255, 128, 64); 
   ballColors[1] = System.Windows.Media.Color.FromRgb(160, 80, 255); 
   ballColors[2] = System.Windows.Media.Color.FromRgb(64, 255, 100); 
   ballColors[3] = System.Windows.Media.Color.FromRgb(100, 255, 255); 
   effect.NumberOfBalls = 10; 
   effect.Size = 15; 
   effect.SizeVariation = 10; 
   effect.HighLightAngle = 4500; 
   effect.HighLightColor = System.Windows.Media.Color.FromRgb(255, 255, 255); 
   effect.BackGroundColor = System.Windows.Media.Color.FromRgb(255, 0, 0); 
   effect.ShadingColor = System.Windows.Media.Color.FromRgb(255, 255, 0); 
   effect.Ripple = 200; 
   effect.BallColorOpacity = 64; 
   effect.BallColorOpacityVariation = 25; 
   effect.Flags = ColoredBallsCommandBitmapEffectsFlags.ShadingCircular | 
                   ColoredBallsCommandBitmapEffectsFlags.Sticker | 
                   ColoredBallsCommandBitmapEffectsFlags.BackGroundImage | 
                   ColoredBallsCommandBitmapEffectsFlags.BallsColorOpacity; 
   effect.BallColors = ballColors; 
   element.BitmapEffect = effect; 
 
   // Initialize Animations 
   ColorAnimation animation1 = new ColorAnimation(); 
   animation1.From = Color.FromRgb(0, 0, 0); 
   animation1.To = Color.FromRgb(255, 0, 0); 
   animation1.By = Color.FromRgb(1, 1, 1); 
   animation1.Duration = new Duration(TimeSpan.FromSeconds(1.0)); 
   animation1.AutoReverse = true; 
   animation1.RepeatBehavior = RepeatBehavior.Forever; 
   Int32Animation animation2 = new Int32Animation(); 
   animation2.From = 0; 
   animation2.To = 255; 
   animation2.By = 1; 
   animation2.Duration = new Duration(TimeSpan.FromSeconds(3.0)); 
   animation2.AutoReverse = true; 
   animation2.RepeatBehavior = RepeatBehavior.Forever; 
 
   // Initialize and run Storyboard 
   Storyboard storyboard = new Storyboard(); 
   Storyboard.SetTargetName(animation1, "AnimatedBitmapEffect"); 
   Storyboard.SetTargetProperty(animation1, new PropertyPath(ColoredBallsCommandBitmapEffect.HighLightColorProperty)); 
   element.RegisterName("AnimatedBitmapEffect", effect); 
   storyboard.Children.Add(animation1); 
   Storyboard.SetTargetName(animation2, "AnimatedBitmapEffect"); 
   Storyboard.SetTargetProperty(animation2, new PropertyPath(ColoredBallsCommandBitmapEffect.BallColorOpacityProperty)); 
   element.RegisterName("AnimatedBitmapEffect", effect); 
   storyboard.Children.Add(animation2); 
 
   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 15\Images\slave.jpg"> 
      <Image.BitmapEffect> 
        <lteffects:ColoredBallsCommandBitmapEffect x:Name="MyBitmapEffect" NumberOfBalls="10" Size="15" SizeVariation="10" HighLightAngle="4500" Ripple="200" BallColorOpacity="100" BallColorOpacityVariation="25" /> 
      </Image.BitmapEffect> 
      <Image.Triggers> 
        <EventTrigger RoutedEvent="Image.Loaded"> 
          <BeginStoryboard> 
            <Storyboard> 
              <ColorAnimation Storyboard.TargetName="MyBitmapEffect" Storyboard.TargetProperty="HighLightColor" From="Black" To="Red" Duration="0:0:1" RepeatBehavior="Forever" AutoReverse="True" /> 
              <Int32Animation Storyboard.TargetName="MyBitmapEffect" Storyboard.TargetProperty="BallColorOpacity" From="0" To="255" Duration="0:0:3" RepeatBehavior="Forever" AutoReverse="True" /> 
            </Storyboard> 
          </BeginStoryboard> 
        </EventTrigger> 
      </Image.Triggers> 
    </Image> 
  </Grid> 
</Page>

Remarks

  • This method 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.ColoredBallsCommandBitmapEffect

Requirements

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

See Also