コード例 #1
0
        private ICanvasImage CreateBlend()
        {
            var rotatedTiger = new Transform3DEffect
            {
                Source = bitmapTiger
            };

            var blendEffect = new BlendEffect
            {
                Background = bitmapTiger,
                Foreground = rotatedTiger
            };

            // Animation swings the second copy of the image back and forth,
            // while cycling through the different blend modes.
            int enumValueCount = Utils.GetEnumAsList <BlendEffectMode>().Count;

            animationFunction = elapsedTime =>
            {
                blendEffect.Mode             = (BlendEffectMode)(elapsedTime / Math.PI % enumValueCount);
                textLabel                    = "Mode: " + blendEffect.Mode;
                rotatedTiger.TransformMatrix = Matrix4x4.CreateRotationZ((float)Math.Sin(elapsedTime));
            };

            return(blendEffect);
        }
コード例 #2
0
        private ICanvasImage CreateBorder()
        {
            var borderEffect = new BorderEffect
            {
                Source = bitmapTiger
            };

            // Animation cycles through the different edge behavior modes.
            int enumValueCount = Utils.GetEnumAsList <CanvasEdgeBehavior>().Count;

            animationFunction = elapsedTime =>
            {
                borderEffect.ExtendX     =
                    borderEffect.ExtendY = (CanvasEdgeBehavior)(elapsedTime % enumValueCount);

                textLabel = "Mode: " + borderEffect.ExtendX;
            };

            return(AddSoftEdgedCrop(borderEffect));
        }