Esempio n. 1
0
        /// <inheritdoc />
        public override bool UpdateCell(Cell cell)
        {
            Color oldForeground = cell.Foreground;
            Color oldBackground = cell.Background;

            if (FadeForeground)
            {
                if (UseCellForeground)
                {
                    DestinationForeground.Stops[UseCellDestinationReverse ? DestinationForeground.Stops.Length - 1 : 0].Color = cell.State.Value.Foreground;
                }

                cell.Foreground = DestinationForeground.Lerp((float)_calculatedValue);
            }

            if (FadeBackground)
            {
                if (UseCellBackground)
                {
                    DestinationBackground.Stops[UseCellDestinationReverse ? DestinationBackground.Stops.Length - 1 : 0].Color = cell.State.Value.Background;
                }

                cell.Background = DestinationBackground.Lerp((float)_calculatedValue);
            }

            return(oldForeground != cell.Foreground || oldBackground != cell.Background);
        }
Esempio n. 2
0
        public override bool Apply(Cell cell)
        {
            if (cell.State == null)
            {
                cell.SaveState();
            }

            var oldForeground = cell.Foreground;
            var oldBackground = cell.Background;

            if (FadeForeground)
            {
                if (UseCellForeground)
                {
                    DestinationForeground.Stops[0].Color = cell.State.Value.Foreground;
                }

                cell.Foreground = DestinationForeground.Lerp((float)_calculatedValue);
            }

            if (FadeBackground)
            {
                if (UseCellBackground)
                {
                    DestinationBackground.Stops[0].Color = cell.State.Value.Background;
                }

                cell.Background = DestinationBackground.Lerp((float)_calculatedValue);
            }

            return(oldForeground != cell.Foreground || oldBackground != cell.Background);
        }
Esempio n. 3
0
        /// <inheritdoc />
        public override bool ApplyToCell(ColoredGlyph cell, EffectsManager.ColoredGlyphState originalState)
        {
            Color oldForeground = cell.Foreground;
            Color oldBackground = cell.Background;

            if (FadeForeground)
            {
                if (UseCellForeground)
                {
                    DestinationForeground.Stops[UseCellDestinationReverse ? DestinationForeground.Stops.Length - 1 : 0].Color = originalState.Foreground;
                }

                cell.Foreground = DestinationForeground.Lerp((float)_calculatedValue);
            }

            if (FadeBackground)
            {
                if (UseCellBackground)
                {
                    DestinationBackground.Stops[UseCellDestinationReverse ? DestinationBackground.Stops.Length - 1 : 0].Color = originalState.Background;
                }

                cell.Background = DestinationBackground.Lerp((float)_calculatedValue);
            }

            return(oldForeground != cell.Foreground || oldBackground != cell.Background);
        }
Esempio n. 4
0
        public override void Apply(Cell cell)
        {
            if (FadeForeground)
            {
                if (UseCellForeground)
                {
                    DestinationForeground.Stops[0].Color = cell.Foreground;
                }

                cell.ActualForeground = DestinationForeground.Lerp((float)_calculatedValue);
            }

            if (FadeBackground)
            {
                if (UseCellBackground)
                {
                    DestinationBackground.Stops[0].Color = cell.Background;
                }

                cell.ActualBackground = DestinationBackground.Lerp((float)_calculatedValue);
            }
        }