Exemple #1
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);
                    }
                }
            }
        }
Exemple #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++;
        }
Exemple #3
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);
        }
Exemple #4
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;
        }