Exemple #1
0
        private CompositionEffectBrush BuildColoredBlurBrush()
        {
            var gaussianBlur = new GaussianBlurEffect
            {
                Name         = "Blur",
                Source       = new CompositionEffectSourceParameter("source"),
                BlurAmount   = 15.0f,
                BorderMode   = EffectBorderMode.Hard,
                Optimization = EffectOptimization.Balanced
            };

            var colorEffect = new ColorSourceEffect
            {
                Name  = "ColorSource2",
                Color = (Color)App.Current.Resources["KlivaMainColor"]
            };

            var blendEffect = new BlendEffect
            {
                Mode = BlendEffectMode.Multiply,

                Background = gaussianBlur,
                Foreground = colorEffect
            };

            var factory = m_compositor.CreateEffectFactory(blendEffect);

            var brush = factory.CreateBrush();

            return(brush);
        }
Exemple #2
0
        private IGraphicsEffect _createRevealBorderEffect()
        {
            var sceneLightingEffect = new Windows.UI.Composition.Effects.SceneLightingEffect();

            sceneLightingEffect.AmbientAmount  = 0f;
            sceneLightingEffect.DiffuseAmount  = sc_diffuseAmountBorder;
            sceneLightingEffect.SpecularAmount = sc_specularAmountBorder;
            sceneLightingEffect.SpecularShine  = sc_specularShineBorder;

            var colorMatrixEffect = new ColorMatrixEffect();

            colorMatrixEffect.ColorMatrix = sc_revealInvertedBorderColorMatrix;
            colorMatrixEffect.AlphaMode   = Microsoft.Graphics.Canvas.CanvasAlphaMode.Straight;
            colorMatrixEffect.Source      = sceneLightingEffect;

            var baseColorEffect = new ColorSourceEffect();

            baseColorEffect.Name  = "BaseColorEffect";
            baseColorEffect.Color = Color.FromArgb(0, 0, 0, 0);

            var compositeEffect = new CompositeEffect();

            compositeEffect.Mode = Microsoft.Graphics.Canvas.CanvasComposite.SourceOver;
            //	Union of source and destination bitmaps. Equation: O = S + (1 - SA) * D.
            compositeEffect.Sources.Add(baseColorEffect);   //Destination
            compositeEffect.Sources.Add(colorMatrixEffect); //Source
            return(compositeEffect);
        }
Exemple #3
0
        private CompositionEffectBrush BuildBlurBrush(Compositor c, float blurAmount, Color maskColor)
        {
            var blurDesc = new GaussianBlurEffect
            {
                Name = "GlassBlur",
                BlurAmount = blurAmount,
                BorderMode = EffectBorderMode.Hard,
                Optimization = EffectOptimization.Balanced,
                Source = new CompositionEffectSourceParameter("Source")
            };

            var colorDesc = new ColorSourceEffect
            {
                Name = "GlassColor",
                Color = maskColor,
            };

            var blendEffectDesc = new BlendEffect
            {
                Mode = BlendEffectMode.Multiply,
                Background = blurDesc,
                Foreground = colorDesc,
            };

            var blurBrush = c.CreateEffectFactory(blendEffectDesc, new[] { "GlassBlur.BlurAmount", "GlassColor.Color" }).CreateBrush();
            blurBrush.SetSourceParameter("Source", c.CreateBackdropBrush());

            return blurBrush;
        }
        void ValidateSourceProperty(PixelShaderEffect effect, Func <IGraphicsEffectSource> getter, Action <IGraphicsEffectSource> setter, int expectedSourceCount, int whichSource)
        {
            // Should be initially null.
            Assert.IsNull(getter());

            // Should always be able to set to null.
            setter(null);
            Assert.IsNull(getter());

            var source = new ColorSourceEffect();

            if (whichSource <= expectedSourceCount)
            {
                // Should be able to set and get non-null values for this source of the shader.
                setter(source);

                Assert.AreEqual(source, getter());
            }
            else
            {
                // Should not be able to set this source.
                Utils.AssertThrowsException <ArgumentException>(
                    () => setter(source),
                    "Source" + whichSource + " must be null when using this pixel shader (shader inputs: " + expectedSourceCount + ").");
            }
        }
        private CompositionEffectBrush CreateBlurBrush()
        {
            var blurEffect = new GaussianBlurEffect()
            {
                Name         = "BlurEffect",
                BlurAmount   = (float)BlurAmount,
                Optimization = EffectOptimization.Balanced,
                Source       = new CompositionEffectSourceParameter("Source"),
                BorderMode   = EffectBorderMode.Hard
            };
            var colorEffect = new ColorSourceEffect()
            {
                Name  = "ColorEffect",
                Color = TintColor
            };
            var blendEffect = new BlendEffect()
            {
                Background = blurEffect,
                Foreground = colorEffect,
                Mode       = BlendEffectMode.SoftLight
            };
            var effectFactory = _compositor.CreateEffectFactory(blendEffect, new[]
            {
                "BlurEffect.BlurAmount",
                "ColorEffect.Color"
            });

            return(effectFactory.CreateBrush());
        }
 private void Initialize(StreamingContext context)
 {
     _type        = LayerType.Color;
     _inputEffect = new ColorSourceEffect();
     // Default to white, otherwise ColorPicker will start with #00000000 on a new layer.
     // Since Alpha is not enabled on the ColorPicker, the Alpha will remain 0 no matter the chosen color.
     Color = Colors.White;
 }
Exemple #7
0
        public CompositionBrush Build(
            Color luminosityColor)
        {
            var adjustedTintOpacity = Math.Clamp(TintOpacity, 0, 1);

            adjustedTintOpacity = 0.3f + 0.7f * adjustedTintOpacity;

            IGraphicsEffectSource backDropEffectSource = new CompositionEffectSourceParameter("Backdrop");

            var luminosityColorEffect = new ColorSourceEffect()
            {
                Name  = "LuminosityColor",
                Color = luminosityColor
            };

            var graphicsEffect = new ArithmeticCompositeEffect
            {
                Source1        = backDropEffectSource,
                Source2        = luminosityColorEffect,
                MultiplyAmount = 0,
                Source1Amount  = 1 - adjustedTintOpacity,
                Source2Amount  = adjustedTintOpacity,
                Offset         = 0
            };

            //IGraphicsEffectSource noiseEffectSource = new CompositionEffectSourceParameter("Noise");
            //var noiseBorderEffect  = new BorderEffect()
            //{
            //    ExtendX = CanvasEdgeBehavior.Wrap,
            //    ExtendY = CanvasEdgeBehavior.Wrap,
            //    Source = noiseEffectSource,
            //};

            //var noiseOpacityEffect = new OpacityEffect()
            //{
            //    Name = "NoiseOpacity",
            //    Opacity = 0.5f,
            //    Source = noiseBorderEffect,
            //};

            //var finalEffect = new CrossFadeEffect()
            //{
            //    Name = "FadeInOut",
            //    Source1 = graphicsEffect,
            //    Source2 = noiseOpacityEffect
            //};

            var effectFactory            = Window.Current.Compositor.CreateEffectFactory(graphicsEffect);
            CompositionEffectBrush brush = effectFactory.CreateBrush();

            var hostBackdropBrush = Window.Current.Compositor.CreateHostBackdropBrush();

            brush.SetSourceParameter("Backdrop", hostBackdropBrush);

            return(brush);
        }
        private void UpdateBrush()
        {
            if (m_isDisabledByPolicy && m_brush is CompositionEffectBrush)
            {
                m_brush.Dispose();
                m_brush = null;
            }

            if (m_brush == null)
            {
                if (m_isDisabledByPolicy)
                {
                    m_brush          = Window.Current.Compositor.CreateColorBrush(FallbackColor);
                    CompositionBrush = m_brush;
                }
                else
                {
                    var gaussianBlur = new GaussianBlurEffect
                    {
                        Name         = "Blur",
                        BlurAmount   = 30,
                        Optimization = EffectOptimization.Speed,
                        BorderMode   = EffectBorderMode.Hard,
                        Source       = new CompositionEffectSourceParameter("Backdrop")
                    };

                    var saturationEffect = new SaturationEffect
                    {
                        Name       = "Saturation",
                        Saturation = 1.7f,
                        Source     = gaussianBlur
                    };

                    var tintColorEffect = new ColorSourceEffect
                    {
                        Name  = "TintColor",
                        Color = Color.FromArgb(52, 0, 0, 0)
                    };

                    var compositeEffect = new CompositeEffect();
                    compositeEffect.Mode = CanvasComposite.SourceOver;
                    compositeEffect.Sources.Add(saturationEffect);
                    compositeEffect.Sources.Add(tintColorEffect);

                    var effectFactory = Window.Current.Compositor.CreateEffectFactory(compositeEffect);
                    var backdrop      = Window.Current.Compositor.CreateBackdropBrush();

                    var brush = effectFactory.CreateBrush();
                    brush.SetSourceParameter("Backdrop", backdrop);

                    m_brush          = brush;
                    CompositionBrush = m_brush;
                }
            }
        }
Exemple #9
0
        public static CompositionBrush BuildMicaEffectBrush(Compositor compositor, Color tintColor, float tintOpacity, float luminosityOpacity)
        {
            // Tint Color.

            var tintColorEffect = new ColorSourceEffect();

            tintColorEffect.Name  = "TintColor";
            tintColorEffect.Color = tintColor;

            // OpacityEffect applied to Tint.
            var tintOpacityEffect = new OpacityEffect();

            tintOpacityEffect.Name    = "TintOpacity";
            tintOpacityEffect.Opacity = tintOpacity;
            tintOpacityEffect.Source  = tintColorEffect;

            // Apply Luminosity:

            // Luminosity Color.
            var luminosityColorEffect = new ColorSourceEffect();

            luminosityColorEffect.Color = tintColor;

            // OpacityEffect applied to Luminosity.
            var luminosityOpacityEffect = new OpacityEffect();

            luminosityOpacityEffect.Name    = "LuminosityOpacity";
            luminosityOpacityEffect.Opacity = luminosityOpacity;
            luminosityOpacityEffect.Source  = luminosityColorEffect;

            // Luminosity Blend.
            var luminosityBlendEffect = new BlendEffect();

            luminosityBlendEffect.Mode       = BlendEffectMode.Color;
            luminosityBlendEffect.Background = new CompositionEffectSourceParameter("BlurredWallpaperBackdrop");
            luminosityBlendEffect.Foreground = luminosityOpacityEffect;

            // Apply Tint:

            // Color Blend.
            var colorBlendEffect = new BlendEffect();

            colorBlendEffect.Mode       = BlendEffectMode.Luminosity;
            colorBlendEffect.Background = luminosityBlendEffect;
            colorBlendEffect.Foreground = tintOpacityEffect;

            CompositionEffectBrush micaEffectBrush = compositor.CreateEffectFactory(colorBlendEffect).CreateBrush();
            var blurredWallpaperBackdropBrush      = (ICompositorWithBlurredWallpaperBackdropBrush)((object)compositor);

            micaEffectBrush.SetSourceParameter("BlurredWallpaperBackdrop", blurredWallpaperBackdropBrush.TryCreateBlurredWallpaperBackdropBrush());

            return(micaEffectBrush);
        }
        private void Create()
        {
            if (_effectFactory == null)
            {
                var color = new ColorSourceEffect
                {
                    Name  = "Colour",
                    Color = this.TintColor
                };

                var opacity = new OpacityEffect
                {
                    Name    = "Opacity",
                    Opacity = 0f,
                    Source  = color
                };

                var blurEffect = new GaussianBlurEffect
                {
                    Name            = "Blur",
                    BlurAmount      = 0,
                    Optimization    = EffectOptimization.Speed,
                    BorderMode      = EffectBorderMode.Hard,
                    BufferPrecision = Microsoft.Graphics.Canvas.CanvasBufferPrecision.Precision16Float,
                    Source          = new CompositionEffectSourceParameter("Source")
                };

                var blend = new BlendEffect
                {
                    Background = blurEffect,
                    Foreground = opacity,
                    Mode       = BlendEffectMode.SoftLight,
                };

                _effectFactory = _compositor.CreateEffectFactory(
                    blend, new string[] { "Blur.BlurAmount", "Colour.Color", "Opacity.Opacity" });
            }

            var brush = _effectFactory.CreateBrush();

            brush.SetSourceParameter("Source", _compositor.CreateHostBackdropBrush());
            this.CompositionBrush = brush;
            UpdateBlur();
            UpdateColor();
        }
Exemple #11
0
        protected override void OnConnected()
        {
            // Delay creating composition resources until they're required.
            if (CompositionBrush == null)
            {
#if !_M_ARM64
                var backdrop = Window.Current.Compositor.CreateBackdropBrush();

                // Use a Win2D blur affect applied to a CompositionBackdropBrush.
                var graphicsEffect = new GaussianBlurEffect
                {
                    Name       = "Blur",
                    BlurAmount = (float)BlurAmount,
                    Source     = new CompositionEffectSourceParameter("backdrop")
                };

                var colorEffect = new ColorSourceEffect
                {
                    Name  = "Tint",
                    Color = TintColor
                };

                var blendEffect = new BlendEffect
                {
                    Background = graphicsEffect,
                    Foreground = colorEffect,
                    Mode       = BlendEffectMode.Overlay
                };

                var effectFactory = Window.Current.Compositor.CreateEffectFactory(blendEffect, new[]
                {
                    "Blur.BlurAmount",
                    "Tint.Color"
                });
                var effectBrush = effectFactory.CreateBrush();

                effectBrush.SetSourceParameter("backdrop", backdrop);

                CompositionBrush = effectBrush;
#else
                CompositionBrush = Window.Current.Compositor.CreateColorBrush(Colors.Black);
#endif
            }
        }
Exemple #12
0
        protected override void OnConnected()
        {
            if (CompositionBrush != null)
            {
                return;
            }

            var backdropBlurEffect = new GaussianBlurEffect
            {
                Name       = "Blur",
                BlurAmount = (float)BlurAmount,
                Source     = new CompositionEffectSourceParameter("backdrop")
            };
            var backgroundColorSourceEffect = new ColorSourceEffect
            {
                Name  = "Tint",
                Color = BackgroundColor
            };
            var backgroundColorOpacityEffect = new OpacityEffect
            {
                Name    = "Opacity",
                Opacity = (float)BackgroundColorOpacity,
                Source  = backgroundColorSourceEffect
            };
            var blendEffect = new BlendEffect
            {
                Background = backdropBlurEffect,
                Foreground = backgroundColorOpacityEffect,
                Mode       = BlendEffectMode.Multiply,
            };

            var effectFactory = Window.Current.Compositor.CreateEffectFactory(blendEffect, new[] { "Blur.BlurAmount", "Tint.Color", "Opacity.Opacity" });
            var effectBrush   = effectFactory.CreateBrush();

            effectBrush.SetSourceParameter("backdrop", Window.Current.Compositor.CreateBackdropBrush());

            CompositionBrush = effectBrush;
        }
 void UpdateShadowEffect()   //This calls UpdateShadowVisualProperties, UpdateShadowMask and UpdateShadowSizeAndOffset.
 {
     if (compositor == null || shadowVisual == null)
     {
         return;
     }
     if (ShouldUseMask)
     {
         isUsingDropShadow = false;
         if (shadowVisual.Shadow != null)
         {
             var oldShadow = shadowVisual.Shadow;
             shadowVisual.Shadow = null;
             oldShadow.Dispose();
         }
         IGraphicsEffectSource alphaMaskSource = new Transform2DEffect()
         {
             Name = transformEffectName, TransformMatrix = Matrix3x2.Identity, Source = new CompositionEffectSourceParameter(effectSourceName)
         };
         if (SpreadRadius > 0)
         {
             var spreadEffectBlur = new GaussianBlurEffect()
             {
                 BlurAmount = (float)SpreadRadius / 3.0f, Source = alphaMaskSource
             };
             alphaMaskSource = new ColorMatrixEffect()
             {
                 ClampOutput = true, ColorMatrix = new Matrix5x4()
                 {
                     M44 = 10.0f
                 }, Source = spreadEffectBlur
             };                                                                                                                                          //The number 10 seems about right
         }
         if (BlurRadius > 0)
         {
             alphaMaskSource = new GaussianBlurEffect()
             {
                 BlurAmount = (float)BlurRadius / 3.0f, Source = alphaMaskSource
             };
         }
         var colorSourceEffect = new ColorSourceEffect()
         {
             Color = Color
         };
         var finalEffect = new AlphaMaskEffect {
             AlphaMask = alphaMaskSource, Source = colorSourceEffect
         };
         CompositionEffectFactory effectFactory;
         try {
             effectFactory = compositor.CreateEffectFactory(finalEffect, new string[] { transformEffectMatrixName });
         } catch (Exception) {
             return;
         }
         var shadowEffectBrush = effectFactory.CreateBrush();
         var oldBrush          = shadowVisual.Brush;
         shadowVisual.Brush = shadowEffectBrush;
         oldBrush?.Dispose();
         UpdateShadowMask();
     }
     else
     {
         isUsingDropShadow = true;
         if (shadowVisual.Brush != null)
         {
             var oldBrush = shadowVisual.Brush;
             shadowVisual.Brush = null;
             oldBrush.Dispose();
         }
         var dropShadow = shadowVisual.Shadow as DropShadow;
         if (dropShadow == null)
         {
             dropShadow = compositor.CreateDropShadow();
             var oldShadow = shadowVisual.Shadow;
             shadowVisual.Shadow = dropShadow;
             oldShadow?.Dispose();
         }
         dropShadow.BlurRadius = (float)Math.Max(BlurRadius, 0.0);
         dropShadow.Color      = Color;
     }
     UpdateShadowVisualProperties();
     UpdateShadowSizeAndOffset();
 }
        //@Construct
        public DottedLinePage2()
        {
            this.InitializeComponent();
            this.Loaded += async(s2, e2) =>
            {
                this.MarkdownText1.Text = await FanKit.Samples.File.GetFile("ms-appx:///TXT/Transformers/DottedLinePage2.xaml.txt");

                this.MarkdownText1.LinkClicked += async(s, e) => await Launcher.LaunchUriAsync(new Uri("https://github.com/ysdy44/FanKit-UWP/blob/master/FanKit/Frames/Transformers/DottedLinePage2.xaml"));

                this.MarkdownText2.Text = await FanKit.Samples.File.GetFile("ms-appx:///TXT/Transformers/DottedLinePage2.xaml.cs.txt");

                this.MarkdownText2.LinkClicked += async(s, e) => await Launcher.LaunchUriAsync(new Uri("https://github.com/ysdy44/FanKit-UWP/blob/master/FanKit/Frames/Transformers/DottedLinePage2.xaml.cs"));
            };

            this.ResetButton.Tapped += (s, e) =>
            {
                using (var ds = this.DottedLineImage.CreateDrawingSession())
                {
                    ds.Clear(Windows.UI.Colors.Transparent);
                }
                this.DottedLineImage.Baking(this.CanvasAnimatedControl);

                this.CanvasTransformer.Fit();
            };
            this.RadianSlider.ValueChanged += (s, e) =>
            {
                float radian = ((float)e.NewValue) * FanKit.Math.Pi / 180.0f;
                this.CanvasTransformer.Radian = radian;
                this.CanvasTransformer.ReloadMatrix();

                Matrix3x2 matrix = this.CanvasTransformer.GetMatrix();
                this.DottedLineImage.Baking(this.CanvasAnimatedControl, matrix);
                this.CanvasAnimatedControl.Invalidate();
            };


            #region Draw


            //Canvas
            this.CanvasAnimatedControl.SizeChanged += (s, e) =>
            {
                if (e.NewSize == e.PreviousSize)
                {
                    return;
                }
                this.CanvasTransformer.Size = e.NewSize;
            };
            this.CanvasAnimatedControl.CreateResources += (sender, args) =>
            {
                CanvasRenderTarget canvasRenderTarget = new CanvasRenderTarget(sender, this.CanvasTransformer.Width, this.CanvasTransformer.Height);
                this.DottedLineImage = new DottedLineImage(canvasRenderTarget);
                this.DottedLineBrush = new DottedLineBrush(sender, 6);

                Matrix3x2 matrix = this.CanvasTransformer.GetMatrix();
                this.DottedLineImage.Baking(sender, matrix);
            };
            this.CanvasAnimatedControl.Draw += (sender, args) =>
            {
                Matrix3x2 matrix = this.CanvasTransformer.GetMatrix();

                //DrawCrad
                var previousImage = new ColorSourceEffect {
                    Color = Windows.UI.Colors.White
                };
                args.DrawingSession.DrawCrad(previousImage, this.CanvasTransformer);

                //DrawDottedLine
                args.DrawingSession.DrawDottedLine(sender, this.DottedLineBrush, this.DottedLineImage, this.CanvasTransformer.Width, this.CanvasTransformer.Height);

                CanvasGeometry canvasGeometry          = this._transformerRect.ToRectangle(sender);
                CanvasGeometry canvasGeometryTransform = canvasGeometry.Transform(matrix);
                args.DrawingSession.DrawThickGeometry(canvasGeometryTransform);
            };
            this.CanvasAnimatedControl.Update += (sender, args) =>
            {
                this.DottedLineBrush.Update(1);
            };


            #endregion


            #region CanvasOperator


            //Single
            this.CanvasOperator.Single_Start += (point) =>
            {
                Matrix3x2 inverseMatrix = this.CanvasTransformer.GetInverseMatrix();
                Vector2   canvasPoint   = Vector2.Transform(point, inverseMatrix);

                this._startingPoint = point;

                this._transformerRect = new TransformerRect(point, point);
            };
            this.CanvasOperator.Single_Delta += (point) =>
            {
                Matrix3x2 inverseMatrix       = this.CanvasTransformer.GetInverseMatrix();
                Vector2   canvasStartingPoint = Vector2.Transform(this._startingPoint, inverseMatrix);
                Vector2   canvasPoint         = Vector2.Transform(point, inverseMatrix);

                this._transformerRect = new TransformerRect(canvasStartingPoint, canvasPoint);
            };
            this.CanvasOperator.Single_Complete += (point) =>
            {
                Matrix3x2 matrix              = this.CanvasTransformer.GetMatrix();
                Matrix3x2 inverseMatrix       = this.CanvasTransformer.GetInverseMatrix();
                Vector2   canvasStartingPoint = Vector2.Transform(this._startingPoint, inverseMatrix);
                Vector2   canvasPoint         = Vector2.Transform(point, inverseMatrix);

                //DottedLine
                using (var ds = this.DottedLineImage.CreateDrawingSession())
                {
                    TransformerRect transformerRect = new TransformerRect(canvasStartingPoint, canvasPoint);
                    ds.FillRectangle(transformerRect.ToRect(), Windows.UI.Colors.Gray);
                }
                this.DottedLineImage.Baking(this.CanvasAnimatedControl, matrix);

                this._transformerRect = new TransformerRect(Vector2.Zero, Vector2.Zero);
            };


            //Right
            this.CanvasOperator.Right_Start += (point) =>
            {
                this.CanvasTransformer.CacheMove(point);
            };
            this.CanvasOperator.Right_Delta += (point) =>
            {
                this.CanvasTransformer.Move(point);

                //DottedLine
                Matrix3x2 matrix = this.CanvasTransformer.GetMatrix();
                this.DottedLineImage.Baking(this.CanvasAnimatedControl, matrix);
                this.CanvasAnimatedControl.Invalidate();
            };
            this.CanvasOperator.Right_Complete += (point) =>
            {
                this.CanvasTransformer.Move(point);

                //DottedLine
                Matrix3x2 matrix = this.CanvasTransformer.GetMatrix();
                this.DottedLineImage.Baking(this.CanvasAnimatedControl, matrix);
                this.CanvasAnimatedControl.Invalidate();
            };


            //Double
            this.CanvasOperator.Double_Start += (center, space) =>
            {
                this.CanvasTransformer.CachePinch(center, space);
                this.CanvasAnimatedControl.Invalidate();
            };
            this.CanvasOperator.Double_Delta += (center, space) =>
            {
                this.CanvasTransformer.Pinch(center, space);

                //DottedLine
                Matrix3x2 matrix = this.CanvasTransformer.GetMatrix();
                this.DottedLineImage.Baking(this.CanvasAnimatedControl, matrix);
                this.CanvasAnimatedControl.Invalidate();
            };
            this.CanvasOperator.Double_Complete += (center, space) =>
            {
                //DottedLine
                Matrix3x2 matrix = this.CanvasTransformer.GetMatrix();
                this.DottedLineImage.Baking(this.CanvasAnimatedControl, matrix);
                this.CanvasAnimatedControl.Invalidate();
            };


            //Wheel
            this.CanvasOperator.Wheel_Changed += (point, space) =>
            {
                if (space > 0)
                {
                    this.CanvasTransformer.ZoomIn(point);
                }
                else
                {
                    this.CanvasTransformer.ZoomOut(point);
                }

                //DottedLine
                Matrix3x2 matrix = this.CanvasTransformer.GetMatrix();
                this.DottedLineImage.Baking(this.CanvasAnimatedControl, matrix);
                this.CanvasAnimatedControl.Invalidate();
            };


            #endregion
        }
Exemple #15
0
 private CompositionEffectBrush CreateBlurBrush()
 {
     var blurEffect = new GaussianBlurEffect()
     {
         Name = "BlurEffect",
         BlurAmount = (float)BlurAmount,
         Optimization = EffectOptimization.Balanced,
         Source = new CompositionEffectSourceParameter("Source"),
         BorderMode = EffectBorderMode.Hard
     };
     var colorEffect = new ColorSourceEffect()
     {
         Name = "ColorEffect",
         Color = TintColor
     };
     var blendEffect = new BlendEffect()
     {
         Background = blurEffect,
         Foreground = colorEffect,
         Mode = BlendEffectMode.SoftLight
     };
     var effectFactory = _compositor.CreateEffectFactory(blendEffect, new[]
     {
         "BlurEffect.BlurAmount",
         "ColorEffect.Color"
     });
     return effectFactory.CreateBrush();
 }