WPF Bitmap Effect in VB.NET: Part 1

In this you learn deeply about the all types of Bitmap Effects in WPF.
  • 3392

Bitmap Effect: Bitmap effects are simple pixel processing operations which is ready-made visual effects that you can apply to any element. The goal of bitmap effects is to give you an easy, declarative way to enhance the appearance of text, images, buttons, and other controls. A bitmap effect takes a BitmapSource as an input and produces a new BitmapSource after applying the effect, such as a blur or drop shadow. Each bitmap effect exposes properties that can control the filtering properties, such as Radius of BlurBitmapEffect.

The all bitmap effect classes that you can use in WPF are listed below:

  • BlurBitmapEffect

  • EmbossBitmapEffect

  • DropShadowBitmapEffect

  • BevelBitmapEffect

  • OuterGlowBitmapEffect

In this article we talk about the first class of Bitmap Effect that is BlurBitmapEffect and latere on the remaining classes.

BlurBitmapEffect: BlurBitmapEffect is one of several effects that are shipped with the SDK, it includes two properties one is Radius property and the other one is KernelType property. The radius type property is used to control the strength of the blur by default it starts with 0 and level goes up to your choice. The KernelType property is used with the radius property and it is used to change the style of blur, the default KernelType property of the blur is Gaussian, and you can use another property like Box, Box property make blur smooth.

Example of Bitmap Effect

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid Background="AliceBlue">
        <Button Height="23" Margin="54,96,61,0" VerticalAlignment="Top">
            <Button.Content>A Blurred Button</Button.Content>
            <Button.BitmapEffect>
                <BlurBitmapEffect Radius="3"></BlurBitmapEffect>
            </Button.BitmapEffect>
        </Button>
        <Button Height="23" Margin="54,49,65,0" VerticalAlignment="Top">
            <Button.Content>Normal Button</Button.Content>
        </Button>
    </Grid>
</
Window>

Output Window

bit1.gif
 

Conclusion

Hope this article clear to you and help to understand the Bitmap Effects in WPF. Learn remaining parts of this article in next few articles.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.