title | author | description | keywords |
---|---|---|---|
PipelineBrush |
Sergio0694 |
A composition brush that can render any custom Win2D/Composition effects chain. |
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, brush, backdrop, blur, Win2D, composition |
The PipelineBrush is a Brush which can render any custom Win2D/Composition effects chain.
[!div class="nextstepaction"] Try it in the sample app
<Border BorderBrush="Black" BorderThickness="1" VerticalAlignment="Center" HorizontalAlignment="Center" Width="400" Height="400">
<Border.Background>
<media:PipelineBrush Source="{effects:BackdropSource}">
<effects:LuminanceToAlphaEffect/>
<effects:OpacityEffect Value="0.4"/>
<effects:BlendEffect
Mode="Multiply"
Source="{effects:BackdropSource}"/>
<effects:BlurEffect Value="16"/>
<effects:ShadeEffect Color="#FF222222" Intensity="0.2"/>
<effects:BlendEffect
Mode="Overlay"
Placement="Foreground"
Source="{effects:TileSource Uri=ms-appx:///Assets/BrushAssets/NoiseTexture.png}"/>
</brushes:PipelineBrush>
</Border.Background>
</Border>
Property | Type | Description |
---|---|---|
Source | PipelineBuilder | The source for the current pipeline |
Effects | IList<IPipelineEffect> | The collection of effects to use in the current pipeline. |
The pipelines of effects that can be built from XAML through the PipelineBrush
type can also be created directly from code behind through the PipelineBuilder
class.
Brush brush =
PipelineBuilder
.FromBackdrop()
.LuminanceToAlpha()
.Opacity(0.4f)
.Blend(
PipelineBuilder.FromBackdrop(),
BlendEffectMode.Multiply)
.Blur(16)
.Shade("#FF222222".ToColor(), 0.4f)
.Blend(
PipelineBuilder.FromTiles("/Assets/BrushAssets/NoiseTexture.png"),
BlendEffectMode.Overlay,
Placement.Foreground)
.AsBrush();
PipelineBrush sample page Source. You can see this in action in the Windows Community Toolkit Sample App.
Device family | Universal, 10.0.17134.0 or higher |
---|---|
Namespace | Microsoft.Toolkit.Uwp.UI.Media |
NuGet package | Microsoft.Toolkit.Uwp.UI.Media |