private Visual MakeImageVisualforFollower(Uri imageUri, Vector2 size)
        {
            //Load profile image into a CompositionImage
            CompositionImage profileImage =
                _compositor.DefaultGraphicsDevice.CreateImageFromUri(imageUri);

            CompositionImage maskImage = _compositor.DefaultGraphicsDevice.CreateImageFromUri(new Uri("ms-appx:///Assets/CircularAlphaMaskInflated.png"));

            CompositeEffect maskComposite = new Microsoft.Graphics.Canvas.Effects.CompositeEffect();

            maskComposite.Sources.Add(new CompositionEffectSourceParameter("image"));
            maskComposite.Sources.Add(new CompositionEffectSourceParameter("maskImage"));
            maskComposite.Mode = Microsoft.Graphics.Canvas.CanvasComposite.DestinationIn;
            maskComposite.Name = "Mask";

            CompositionEffectFactory effectFactory = _compositor.CreateEffectFactory(maskComposite);

            CompositionEffect maskEffect = effectFactory.CreateEffect();

            maskEffect.SetSourceParameter("image", profileImage);
            maskEffect.SetSourceParameter("maskImage", maskImage);

            EffectVisual profileImageVisual = _compositor.CreateEffectVisual();

            profileImageVisual.Effect = maskEffect;
            profileImageVisual.Size   = size;

            return(profileImageVisual);
        }
        private void AddImageVisualForFollower(Uri imageUri, Vector3 offset, Vector2 size)
        {
            //Load profile image into a CompositionImage
            CompositionImage profileImage =
                _compositor.DefaultGraphicsDevice.CreateImageFromUri(imageUri);

            CompositionImage maskImage = _compositor.DefaultGraphicsDevice.CreateImageFromUri(new Uri("ms-appx:///Assets/CircularAlphaMaskInflated.png"));

            //Configure effect graph
            CompositeEffect maskCompositEffectDescription = new Microsoft.Graphics.Canvas.Effects.CompositeEffect();

            maskCompositEffectDescription.Sources.Add(new CompositionEffectSourceParameter("image"));
            maskCompositEffectDescription.Sources.Add(new CompositionEffectSourceParameter("maskImage"));
            maskCompositEffectDescription.Mode = Microsoft.Graphics.Canvas.CanvasComposite.DestinationIn;
            maskCompositEffectDescription.Name = "Mask";

            //Create an effect factory for the graph
            CompositionEffectFactory effectFactory = _compositor.CreateEffectFactory(maskCompositEffectDescription);

            //Create an instance of the effect and set source parameters
            CompositionEffect maskEffect = effectFactory.CreateEffect();

            maskEffect.SetSourceParameter("image", profileImage);
            maskEffect.SetSourceParameter("maskImage", maskImage);

            //Add main profile picture visual
            EffectVisual profileImageVisual = _compositor.CreateEffectVisual();

            profileImageVisual.Effect = maskEffect;
            profileImageVisual.Size   = size;
            profileImageVisual.Offset = offset;

            //Add ImageVisual to tree
            _rootVisual.Children.InsertAtTop(profileImageVisual);
        }