Exemple #1
0
 public ICanvasImage ApplyEffect(ICanvasImage source, float value)
 {
     Effect = new StraightenEffect
     {
         Source       = source,
         Angle        = (float)(value / 500 * 2),
         MaintainSize = true
     };
     return(Effect);
 }
Exemple #2
0
        private ICanvasImage CreateStraighten()
        {
            textLabel = requiresWin10;

            var straightenEffect = new StraightenEffect
            {
                Source       = bitmapTiger,
                MaintainSize = true
            };

            // Animation rotates the image from side to side.
            animationFunction = elapsedTime =>
            {
                straightenEffect.Angle = (float)Math.Sin(elapsedTime) * 0.2f;
            };

            return(straightenEffect);
        }
Exemple #3
0
        public void StraightenEffectDoesNotSupportHighQualityInterpolation()
        {
            var effect = new StraightenEffect();

            var supportedModes = from mode in Enum.GetValues(typeof(CanvasImageInterpolation)).Cast <CanvasImageInterpolation>()
                                 where mode != CanvasImageInterpolation.HighQualityCubic
                                 select mode;

            foreach (var interpolationMode in supportedModes)
            {
                effect.InterpolationMode = interpolationMode;
                Assert.AreEqual(interpolationMode, effect.InterpolationMode);
            }

            Assert.ThrowsException <ArgumentException>(() =>
            {
                effect.InterpolationMode = CanvasImageInterpolation.HighQualityCubic;
            });
        }