Skip to content

GPU-based image effects (brightness, contrast) for WPF

License

Notifications You must be signed in to change notification settings

usercode/WPF.ImageEffects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPF.ImageEffects

GPU-based image effects (brightness, contrast) for WPF

https://www.nuget.org/packages/WPF.ImageEffects

nuget for WPF Core (.NET 5)

nuget for WPF (.NET 4.6)

How to use it

  1. Add clr namespace to root node:
<Window x:Class="WPF.ImageEffects.Demo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:imageeffects="clr-namespace:WPF.ImageEffects;assembly=WPF.ImageEffects"
        xmlns:local="clr-namespace:WPF.ImageEffects.Demo"
        Title="MainWindow">
  1. Place shader effect to image control
<Slider x:Name="sliderBrightness" Minimum="-1" Maximum="1" Value="0" />
<Slider x:Name="sliderContrast" Minimum="-1" Maximum="1" Value="0" />

<Image x:Name="image">
            <Image.Effect>
                <imageeffects:BrightnessContrastEffect 
                                        Brightness="{Binding Value, ElementName=sliderBrightness}" 
                                        Contrast="{Binding Value, ElementName=sliderContrast}" />
            </Image.Effect>
</Image>