BitmapEffect Class
Assembly: PresentationCore (in PresentationCore.dll)
'Declaration <UIPermissionAttribute(SecurityAction.InheritanceDemand, Window := UIPermissionWindow.AllWindows)> _ Public MustInherit Class BitmapEffect _ Inherits Animatable 'Usage Dim instance As BitmapEffect
This class is abstract; see Inheritance Hierarchy for derived non-abstract classes usable in XAML.
Note: |
|---|
WPF bitmap effects are software rendered. Any object that applies an effect will also be rendered in software. Bitmap effects should not be applied to large visuals or animations, because this can degrade performance. |
Caution: |
|---|
Bitmap effects do not support partial trust execution. An application must have full trust permissions to use bitmap effects. |
Scale transforms are applied to a visual before an effect is applied. In the event of a non-uniform scale transform, the effect will use the larger of the scale values.
Updates to the visual tree of a VisualBrush will not propagate if a BitmapEffect is in the brush's parent chain. You can work around this limitation by forcing an update of the scene on the parent object of the effect. You can call InvalidateVisual or include an animation to force a scene update.
Custom effects inherit this class to create a managed interface to the unmanaged effect. For more details on creating custom effect see the Custom BitmapEffect Sample - RGBFilter and the Unmanaged BitmapEffect API.
Notes to Inheritors:CreateUnmanagedEffect must be overridden to initialize an unmanaged effect in managed code.
UpdateUnmanagedPropertyState must be overridden when an unmanaged effect has properties that the user can modify. Use this method in conjunction with SetValue to update your unmanaged properties.
This example shows how to use a custom effect in Extensible Application Markup Language (XAML).
Custom effects are created with unmanaged API and create a Component Object Model (COM) dynamic-link library (DLL). To use custom effect in managed code, a managed assembly is used to define the BitmapEffect and to interact with the Component Object Model (COM) library. To use this custom effect in an application, the assembly must be referenced and the effect must use the namespace referenced by the assembly. For the complete sample, see Custom BitmapEffect Sample - RGBFilter.
The following example shows how to define a namespace and reference the assembly that implements the custom effect.
<Window x:Class="RGBFilterEffectTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="RGBFilterEffectTest" Height="400" Width="300" xmlns:RGBFilter="clr-namespace:RGBFilter;assembly=ManagedRGBFilterBitmapEffect" xmlns:MappingPIGen1="clr-namespace:RGBFilter;assembly=ManagedRGBFilterBitmapEffect">
The following example uses the custom effect by referencing the namespace provided in the above example.
<Image Name="RTB" Source="images/kittens.jpg"> <Image.BitmapEffect> <RGBFilter:RGBFilterBitmapEffect > <RGBFilter:RGBFilterBitmapEffect.Red> <Binding ElementName="redSlider" Path="Value"/> </RGBFilter:RGBFilterBitmapEffect.Red> <RGBFilter:RGBFilterBitmapEffect.Green> <Binding ElementName="greenSlider" Path="Value"/> </RGBFilter:RGBFilterBitmapEffect.Green> <RGBFilter:RGBFilterBitmapEffect.Blue> <Binding ElementName="blueSlider" Path="Value"/> </RGBFilter:RGBFilterBitmapEffect.Blue> </RGBFilter:RGBFilterBitmapEffect > </Image.BitmapEffect> </Image>
- UIPermission
for inheriting the BitmapEffect class. Associated enumerations: UIPermissionWindow.AllWindows
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Freezable
System.Windows.Media.Animation.Animatable
System.Windows.Media.Effects.BitmapEffect
System.Windows.Media.Effects.BevelBitmapEffect
System.Windows.Media.Effects.BitmapEffectGroup
System.Windows.Media.Effects.BlurBitmapEffect
System.Windows.Media.Effects.DropShadowBitmapEffect
System.Windows.Media.Effects.EmbossBitmapEffect
System.Windows.Media.Effects.OuterGlowBitmapEffect
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note: