←Select platform

ClearColor Property

Summary
Gets or sets the color to use to clear the area outside the shutter. This is a dependency property.
Syntax
C#
C++/CLI
public Color ClearColor { get; set; } 
public: 
property Color ClearColor { 
   Color get(); 
   void set (    Color ); 
} 

Property Value

The color to use to clear the area outside the shutter. Default value is a solid Black color.

Remarks

This effect uses the Center, Width and Height properties to construct the shutter area. The area outside the shutter are cleared using the color set in the ClearColor property.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.Windows.Controls; 
using Leadtools.Windows.Media; 
using Leadtools.Windows.Media.Effects; 
 
class RectangularShutterEffectExampleWindow : Window 
{ 
   private ImageViewer theViewer; 
 
   public RectangularShutterEffectExampleWindow() 
   { 
      StackPanel sp = new StackPanel(); 
      Content = sp; 
 
      theViewer = new ImageViewer(); 
 
      theViewer.HorizontalAlignment = HorizontalAlignment.Center; 
      theViewer.VerticalAlignment = VerticalAlignment.Top; 
      theViewer.ImageHorizontalAlignment = HorizontalAlignment.Left; 
      theViewer.ImageVerticalAlignment = VerticalAlignment.Top; 
 
      sp.Children.Add(theViewer); 
 
      // Load an image into the viewer 
      theViewer.Source = new BitmapImage(new Uri(System.IO.Path.Combine(LEAD_VARS.ImagesDir, "Cannon.jpg"))); 
 
      Title = "RectangularShutterEffect - Click and and move the mouse cursor on the image to see the effect"; 
 
      theViewer.PreviewMouseDown += new MouseButtonEventHandler(theViewer_PreviewMouseDown); 
      theViewer.MouseMove += new MouseEventHandler(theViewer_MouseMove); 
      theViewer.MouseUp += new MouseButtonEventHandler(theViewer_MouseUp); 
   } 
 
   private void theViewer_PreviewMouseDown(object sender, MouseButtonEventArgs e) 
   { 
      RectangularShutterEffect effect = new RectangularShutterEffect(); 
 
      Point pos = e.GetPosition(theViewer); 
 
      BitmapSource source = theViewer.Source as BitmapSource; 
      if (source != null) 
      { 
         effect.Center = new Point( 
            (1.0 * pos.X) / source.PixelWidth, 
            (1.0 * pos.Y) / source.PixelHeight); 
 
         effect.Width = 0.125; 
         effect.Height = 0.125; 
         effect.ClearColor = Colors.Blue; 
         theViewer.ImageEffect = effect; 
      } 
   } 
 
   private void theViewer_MouseMove(object sender, MouseEventArgs e) 
   { 
      RectangularShutterEffect effect = theViewer.ImageEffect as RectangularShutterEffect; 
      if (effect != null) 
      { 
         Point pos = e.GetPosition(theViewer); 
 
         BitmapSource source = theViewer.Source as BitmapSource; 
         if (source != null) 
         { 
            effect.Center = new Point( 
               (1.0 * pos.X) / source.PixelWidth, 
               (1.0 * pos.Y) / source.PixelHeight); 
         } 
      } 
   } 
 
   private void theViewer_MouseUp(object sender, MouseButtonEventArgs e) 
   { 
      if (theViewer.ImageEffect != null) 
      { 
         theViewer.ImageEffect = null; 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Windows.Media.Effects Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.