public class ContrastAdjustEffect : ShaderEffect Public Class ContrastAdjustEffectInherits System.Windows.Media.Effects.ShaderEffectImplements System.Windows.Media.Animation.IAnimatable
public ref class ContrastAdjustEffect : public System.Windows.Media.Effects.ShaderEffect, System.Windows.Media.Animation.IAnimatable using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.Windows.Controls;using Leadtools.Windows.Media;using Leadtools.Windows.Media.Effects;class ContrastAdjustEffectExampleWindow : Window{public ContrastAdjustEffectExampleWindow(){StackPanel sp = new StackPanel();Content = sp;ImageViewer theViewer = new ImageViewer();theViewer.HorizontalAlignment = HorizontalAlignment.Center;theViewer.VerticalAlignment = VerticalAlignment.Top;theViewer.ImageHorizontalAlignment = HorizontalAlignment.Left;theViewer.ImageVerticalAlignment = VerticalAlignment.Top;sp.Children.Add(theViewer);// Create the slidersTextBlock tb = new TextBlock();tb.HorizontalAlignment = HorizontalAlignment.Center;tb.Text = "Brightness:";sp.Children.Add(tb);Slider brightnessSlider = new Slider();brightnessSlider.Minimum = 0.0;brightnessSlider.Maximum = 2.0;brightnessSlider.Width = 400;brightnessSlider.Orientation = Orientation.Horizontal;brightnessSlider.IsSnapToTickEnabled = true;brightnessSlider.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight;brightnessSlider.TickFrequency = 0.1;brightnessSlider.AutoToolTipPrecision = 2;brightnessSlider.AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.BottomRight;sp.Children.Add(brightnessSlider);tb = new TextBlock();tb.HorizontalAlignment = HorizontalAlignment.Center;tb.Text = "Contrast:";sp.Children.Add(tb);Slider contrastSlider = new Slider();contrastSlider.Minimum = 0.0;contrastSlider.Maximum = 2.0;contrastSlider.Width = 400;contrastSlider.Orientation = Orientation.Horizontal;contrastSlider.IsSnapToTickEnabled = true;contrastSlider.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight;contrastSlider.TickFrequency = 0.1;contrastSlider.AutoToolTipPrecision = 2;contrastSlider.AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.BottomRight;sp.Children.Add(contrastSlider);// Load an image into the viewertheViewer.Source = new BitmapImage(new Uri(System.IO.Path.Combine(LEAD_VARS.ImagesDir, "Cannon.jpg")));// Create the effectContrastAdjustEffect effect = new ContrastAdjustEffect();effect.Brightness = 0.0;effect.Contrast = 1.2;theViewer.ImageEffect = effect;// Bind the propertiesBinding bind = new Binding();bind.Source = effect;bind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;bind.Path = new PropertyPath("Brightness");brightnessSlider.SetBinding(Slider.ValueProperty, bind);bind = new Binding();bind.Source = effect;bind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;bind.Path = new PropertyPath("Contrast");contrastSlider.SetBinding(Slider.ValueProperty, bind);Title = "Using ContrastAdjustEffect";}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.Windows.ControlsImports Leadtools.Windows.MediaImports Leadtools.Windows.Media.EffectsClass ContrastAdjustEffectExampleWindowInherits WindowPublic Sub New()Dim sp As New StackPanel()Content = spDim theViewer As New ImageViewer()theViewer.HorizontalAlignment = HorizontalAlignment.CentertheViewer.VerticalAlignment = VerticalAlignment.ToptheViewer.ImageHorizontalAlignment = HorizontalAlignment.LefttheViewer.ImageVerticalAlignment = VerticalAlignment.Topsp.Children.Add(theViewer)' Create the slidersDim tb As New TextBlock()tb.HorizontalAlignment = HorizontalAlignment.Centertb.Text = "Brightness:"sp.Children.Add(tb)Dim brightnessSlider As New Slider()brightnessSlider.Minimum = 0.0brightnessSlider.Maximum = 2.0brightnessSlider.Width = 400brightnessSlider.Orientation = Orientation.HorizontalbrightnessSlider.IsSnapToTickEnabled = TruebrightnessSlider.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRightbrightnessSlider.TickFrequency = 0.1brightnessSlider.AutoToolTipPrecision = 2brightnessSlider.AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.BottomRightsp.Children.Add(brightnessSlider)tb = New TextBlock()tb.HorizontalAlignment = HorizontalAlignment.Centertb.Text = "Contrast:"sp.Children.Add(tb)Dim contrastSlider As New Slider()contrastSlider.Minimum = 0.0contrastSlider.Maximum = 2.0contrastSlider.Width = 400contrastSlider.Orientation = Orientation.HorizontalcontrastSlider.IsSnapToTickEnabled = TruecontrastSlider.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRightcontrastSlider.TickFrequency = 0.1contrastSlider.AutoToolTipPrecision = 2contrastSlider.AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.BottomRightsp.Children.Add(contrastSlider)' Load an image into the viewertheViewer.Source = New BitmapImage(New Uri(System.IO.Path.Combine(LEAD_VARS.ImagesDir, "Cannon.jpg")))' Create the effectDim effect As New ContrastAdjustEffect()effect.Brightness = 0.0effect.Contrast = 1.2theViewer.ImageEffect = effect' Bind the propertiesDim bind As New Binding()bind.Source = effectbind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChangedbind.Path = New PropertyPath("Brightness")brightnessSlider.SetBinding(Slider.ValueProperty, bind)bind = New Binding()bind.Source = effectbind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChangedbind.Path = New PropertyPath("Contrast")contrastSlider.SetBinding(Slider.ValueProperty, bind)Title = "Using ContrastAdjustEffect"End SubEnd ClassPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
