本文整理汇总了C#中Compositor.CreateEffectVisual方法的典型用法代码示例。如果您正苦于以下问题:C# Compositor.CreateEffectVisual方法的具体用法?C# Compositor.CreateEffectVisual怎么用?C# Compositor.CreateEffectVisual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Compositor
的用法示例。
在下文中一共展示了Compositor.CreateEffectVisual方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LayoutRoot_Loaded
async void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
{
// get visuals from xaml object
_touchAreaVisual = GetVisual(this.TouchArea);
var imagePanelVisual = GetVisual(this.ImagePanel);
// get compositor
_compositor = imagePanelVisual.Compositor;
// load the background image
var image = _compositor.DefaultGraphicsDevice.CreateImageFromUri(new Uri("ms-appx:///Assets/White.png"));
await image.CompleteLoadAsync();
// todo: not sure why GaussianBlurEffect doesn't work??
// Got a feeling it might have something to do with the Source setting,
// maybe it's just not supported yet?
var effectDefination = new SaturationEffect // new GaussianBlurEffect
{
//BorderMode = EffectBorderMode.Soft,
//BlurAmount = 5f,
//Optimization = EffectOptimization.Quality,
Source = new CompositionEffectSourceParameter("Overlay")
};
// create the actual effect
var effectFactory = _compositor.CreateEffectFactory(effectDefination);
var effect = effectFactory.CreateEffect();
effect.SetSourceParameter("Overlay", image);
// create the effect visual
_effectVisual = _compositor.CreateEffectVisual();
_effectVisual.Effect = effect;
_effectVisual.Opacity = 0.8f;
_effectVisual.Size = new Vector2((float)this.ImagePanel.ActualWidth, (float)this.ImagePanel.ActualHeight);
// place the effect visual onto the UI
imagePanelVisual.Children.InsertAtTop(_effectVisual);
}