예제 #1
0
파일: Fade.cs 프로젝트: zxsean/SadConsole
        /// <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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
            }
        }