Esempio n. 1
0
        /// <summary>
        /// Push a new effect.
        /// </summary>
        /// <param name="guid">GUID of the effect.</param>
        /// <returns>EffectChain.</returns>
        public EffectChain PushEffect(Guid guid)
        {
            var effect = new D2D.Effect(this.DeviceContext, guid);

            if (this.Effects.Count != 0)
            {
                effect.SetInputEffect(0, this.Effects.Last(), false);
            }

            this.Effects.Add(effect);
            this.CompositeEffect.SetInputEffect(0, effect, false);
            return(this);
        }
Esempio n. 2
0
        private void CreateEffectGraph(SharpDX.WIC.FormatConverter formatConverter)
        {
            // Setup local variables
            var d2dDevice  = _deviceManager.DeviceDirect2D;
            var d2dContext = _deviceManager.ContextDirect2D;

            // Effect 1 : BitmapSource - take decoded image data and get a BitmapSource from it
            bitmapSourceEffect = new SharpDX.Direct2D1.Effects.BitmapSource(d2dContext);
            bitmapSourceEffect.WicBitmapSource = formatConverter;
            bitmapSourceEffect.Cached          = true; // Because the image will not be changing, we should cache the effect for performance reasons.

            // Effect 2 : PointSpecular
            _deviceManager.FactoryDirect2D.RegisterEffect <WaveEffect>();
            _waveEffect = new Effect <WaveEffect>(_deviceManager.ContextDirect2D);
            _waveEffect.SetInputEffect(0, bitmapSourceEffect);
        }
Esempio n. 3
0
        private void CreateEffectGraph(SharpDX.WIC.FormatConverter formatConverter)
        {
            // Setup local variables
            var d2dDevice = _deviceManager.DeviceDirect2D;
            var d2dContext = _deviceManager.ContextDirect2D;

            // Effect 1 : BitmapSource - take decoded image data and get a BitmapSource from it
            bitmapSource = new SharpDX.Direct2D1.Effects.BitmapSource(d2dContext);
            bitmapSource.WicBitmapSource = formatConverter;
            bitmapSource.Cached = true; // Because the image will not be changing, we should cache the effect for performance reasons.
            
            // Effect 2 : PointSpecular
            _deviceManager.FactoryDirect2D.RegisterEffect<RippleEffect>();
            _rippleEffect = new Effect<RippleEffect>(_deviceManager.ContextDirect2D);
            _rippleEffect.SetInputEffect(0, bitmapSource);
        }