示例#1
0
        public static void DrawBackground(Graphics g, Color timerColor, Color settingsColor1, Color settingsColor2,
                                          float width, float height, DeltasGradientType gradientType)
        {
            var background1 = settingsColor1;
            var background2 = settingsColor2;

            if (gradientType == DeltasGradientType.PlainWithDeltaColor ||
                gradientType == DeltasGradientType.HorizontalWithDeltaColor ||
                gradientType == DeltasGradientType.VerticalWithDeltaColor)
            {
                double h, s, v;
                timerColor.ToHSV(out h, out s, out v);
                var newColor = ColorExtensions.FromHSV(h, s * 0.5, v * 0.25);

                if (gradientType == DeltasGradientType.PlainWithDeltaColor)
                {
                    background1 = Color.FromArgb(timerColor.A * 7 / 12, newColor);
                }
                else
                {
                    background1 = Color.FromArgb(timerColor.A / 6, newColor);
                    background2 = Color.FromArgb(timerColor.A, newColor);
                }
            }
            if (background1.A > 0 ||
                gradientType != DeltasGradientType.Plain &&
                background2.A > 0)
            {
                var gradientBrush = new LinearGradientBrush(
                    new PointF(0, 0),
                    gradientType == DeltasGradientType.Horizontal ||
                    gradientType == DeltasGradientType.HorizontalWithDeltaColor
                            ? new PointF(width, 0)
                            : new PointF(0, height),
                    background1,
                    gradientType == DeltasGradientType.Plain ||
                    gradientType == DeltasGradientType.PlainWithDeltaColor
                            ? background1
                            : background2);
                g.FillRectangle(gradientBrush, 0, 0, width, height);
            }
        }
示例#2
0
        public static string GetBackgroundTypeString(DeltasGradientType type)
        {
            switch (type)
            {
            case DeltasGradientType.Horizontal:
                return("Horizontal Gradient");

            case DeltasGradientType.HorizontalWithDeltaColor:
                return("Horizontal With Delta Color");

            case DeltasGradientType.PlainWithDeltaColor:
                return("Plain With Delta Color");

            case DeltasGradientType.Vertical:
                return("Vertical");

            case DeltasGradientType.VerticalWithDeltaColor:
                return("Vertical With Delta Color");

            case DeltasGradientType.Plain:
            default:
                return("Plain");
            }
        }
示例#3
0
        public static void DrawBackground(Graphics g, LiveSplitState state, Color timerColor, Color settingsColor1, Color settingsColor2,
                                          float width, float height, DeltasGradientType gradientType, Color tickColor1, Color tickColor2, String timeMethod)
        {
            var background1 = settingsColor1;
            var background2 = settingsColor2;

            RectangleF[] clockData           = new RectangleF[24];
            var          tickColor           = tickColor1;
            var          backgroundTickColor = tickColor2;

            // Width / by 6
            // Height / by 4m
            // 1 px around all
            for (int x = 0; x < 6; x++)
            {
                for (int y = 0; y < 4; y++)
                {
                    clockData[(x * 4) + y] = new RectangleF {
                        Y = 1 + (((height / 4f) - 0f) * y), X = 1 + (((width / 6f) - 0f) * x), Width = ((width / 6f) - 2f), Height = (height / 4f) - 2f
                    };
                }
            }
            var test = numCalculator(state, timeMethod);

            var tickBrush           = new SolidBrush(tickColor);
            var backgroundTickBrush = new SolidBrush(backgroundTickColor);

            g.FillRectangles(backgroundTickBrush, clockData);

            foreach (int i in test)
            {
                g.FillRectangle(tickBrush, clockData[i]);
            }

            if (gradientType == DeltasGradientType.PlainWithDeltaColor ||
                gradientType == DeltasGradientType.HorizontalWithDeltaColor ||
                gradientType == DeltasGradientType.VerticalWithDeltaColor)
            {
                double h, s, v;
                timerColor.ToHSV(out h, out s, out v);
                var newColor = ColorExtensions.FromHSV(h, s * 0.5, v * 0.25);

                if (gradientType == DeltasGradientType.PlainWithDeltaColor)
                {
                    background1 = Color.FromArgb(timerColor.A * 7 / 12, newColor);
                }
                else
                {
                    background1 = Color.FromArgb(timerColor.A / 6, newColor);
                    background2 = Color.FromArgb(timerColor.A, newColor);
                }
            }
            if (background1.A > 0 ||
                gradientType != DeltasGradientType.Plain &&
                background2.A > 0)
            {
                var gradientBrush = new LinearGradientBrush(
                    new PointF(0, 0),
                    gradientType == DeltasGradientType.Horizontal ||
                    gradientType == DeltasGradientType.HorizontalWithDeltaColor
                            ? new PointF(width, 0)
                            : new PointF(0, height),
                    background1,
                    gradientType == DeltasGradientType.Plain ||
                    gradientType == DeltasGradientType.PlainWithDeltaColor
                            ? background1
                            : background2);
                g.FillRectangle(gradientBrush, 0, 0, width, height);
                //g.FillRectangles(Brushes.Green, clockData);
            }
        }