Beispiel #1
0
        protected override EffectTypeModuleData CreateInstanceForClone()
        {
            CountDownData result = new CountDownData
            {
                GradientColors = GradientColors.ToList(),
                Direction      = Direction,
                Speed          = Speed,
                CenterStop     = CenterStop,
                Orientation    = Orientation,
                YOffsetCurve   = new Curve(YOffsetCurve),
                XOffsetCurve   = new Curve(XOffsetCurve),
                AngleCurve     = new Curve(AngleCurve),
                GradientMode   = GradientMode,
                Font           = new SerializableFont(Font.FontValue),
                LevelCurve     = LevelCurve,
                FontScaleCurve = new Curve(FontScaleCurve),
                TimeFormat     = TimeFormat,
                Fade           = Fade,
                CountDownType  = CountDownType,
                CountDownFade  = CountDownFade,
                CountDownTime  = CountDownTime,
                PerIteration   = PerIteration,
                SizeMode       = SizeMode
            };

            return(result);
        }
Beispiel #2
0
        private void DrawText(Graphics g, Rectangle clipRectangle, string displayedText, LinearGradientMode mode, int startX)
        {
            Font  adjustedFont    = Vixen.Common.Graphics.GetAdjustedFont(g, displayedText, clipRectangle, Font.Name, 48, Font);
            SizeF adjustedSizeNew = g.MeasureString(displayedText, adjustedFont);
            var   brush           = new LinearGradientBrush(
                new Rectangle(clipRectangle.X + startX, 2, (int)adjustedSizeNew.Width, (int)adjustedSizeNew.Height),
                Color.Black,
                Color.Black, mode)
            {
                InterpolationColors = GradientColors[_countDownNumberIteration % GradientColors.Count()].GetColorBlend()
            };

            g.DrawString(displayedText, adjustedFont, brush, clipRectangle.X + startX, 2);
            _countDownNumberIteration++;

            if (Spinner)
            {
                int       squareWidth = Math.Min((int)adjustedSizeNew.Width, (int)adjustedSizeNew.Height);
                Rectangle rect        = new Rectangle(clipRectangle.X + startX, 2 + ((int)adjustedSizeNew.Height - squareWidth) / 2, squareWidth, squareWidth);

                using (Brush crossHashBrush = CreateCrossHashBrush(g, rect))
                {
                    using (Pen pen = new Pen(crossHashBrush, 1))
                    {
                        DrawFilmSpinnerCrossHash(g, rect, pen);
                    }
                }
            }
        }
Beispiel #3
0
        private void DrawText(Graphics g, Rectangle clipRectangle, string displayedText, LinearGradientMode mode, int startX)
        {
            Font  adjustedFont    = Vixen.Common.Graphics.GetAdjustedFont(g, displayedText, clipRectangle, Font.Name, 48, Font);
            SizeF adjustedSizeNew = g.MeasureString(displayedText, adjustedFont);
            var   brush           = new LinearGradientBrush(
                new Rectangle(clipRectangle.X + startX, 2, (int)adjustedSizeNew.Width, (int)adjustedSizeNew.Height),
                Color.Black,
                Color.Black, mode)
            {
                InterpolationColors = GradientColors[_countDownNumberIteration % GradientColors.Count()].GetColorBlend()
            };

            g.DrawString(displayedText, adjustedFont, brush, clipRectangle.X + startX, 2);
            _countDownNumberIteration++;
        }
Beispiel #4
0
        private ColorGradient GetNewGolorGradient()
        {
            ColorGradient cg = new ColorGradient(GradientColors[_countDownNumberIteration % GradientColors.Count()]);

            foreach (var color in cg.Colors)
            {
                HSV hsv = HSV.FromRGB(color.Color.ToRGB());
                if (CountDownFade != CountDownFade.None)
                {
                    hsv.V *= _fade;
                }
                hsv.V      *= _level;
                color.Color = XYZ.FromRGB(hsv.ToRGB());
            }
            return(cg);
        }
Beispiel #5
0
        private void DrawTextAcrossGradient(String text, Graphics g, Point p, LinearGradientMode mode)
        {
            var           size        = g.MeasureString(text, _newfont);
            var           offset      = _maxTextSize - (int)size.Width;
            var           offsetPoint = new Point(p.X + offset / 2, p.Y);
            ColorGradient cg          = _level < 1 || CountDownFade != CountDownFade.None ? GetNewGolorGradient() : new ColorGradient(GradientColors[_countDownNumberIteration % GradientColors.Count()]);
            var           brush       = new LinearGradientBrush(new Rectangle(0, 0, BufferWi, BufferHt),
                                                                Color.Black,
                                                                Color.Black, mode)
            {
                InterpolationColors = cg.GetColorBlend()
            };

            DrawTextWithBrush(text, brush, g, offsetPoint);
            brush.Dispose();
            p.Y += (int)size.Height;
        }