public void DrawUnscaled(Graphics g, LiveSplitState state, float width, float height) { BigTextLabel.ShadowColor = state.LayoutSettings.ShadowsColor; BigTextLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; BigTextLabel.HasShadow = state.LayoutSettings.DropShadows; SmallTextLabel.ShadowColor = state.LayoutSettings.ShadowsColor; SmallTextLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; SmallTextLabel.HasShadow = state.LayoutSettings.DropShadows; UpdateTimeFormat(); var smallFont = TimerDecimalPlacesFont; var bigFont = TimerFont; var sizeMultiplier = bigFont.Size / bigFont.FontFamily.GetEmHeight(bigFont.Style); var smallSizeMultiplier = smallFont.Size / bigFont.FontFamily.GetEmHeight(bigFont.Style); var ascent = sizeMultiplier * bigFont.FontFamily.GetCellAscent(bigFont.Style); var descent = sizeMultiplier * bigFont.FontFamily.GetCellDescent(bigFont.Style); var smallAscent = smallSizeMultiplier * smallFont.FontFamily.GetCellAscent(smallFont.Style); var shift = (height - ascent - descent) / 2f; BigTextLabel.X = width - 499 - SmallTextLabel.ActualWidth; SmallTextLabel.X = width - SmallTextLabel.ActualWidth - 6; BigTextLabel.Y = shift; SmallTextLabel.Y = shift + ascent - smallAscent; BigTextLabel.Height = 150f; SmallTextLabel.Height = 150f; BigTextLabel.IsMonospaced = true; SmallTextLabel.IsMonospaced = true; if (Settings.ShowGradient && BigTextLabel.Brush is SolidBrush) { var originalColor = (BigTextLabel.Brush as SolidBrush).Color; double h, s, v; originalColor.ToHSV(out h, out s, out v); var bottomColor = ColorExtensions.FromHSV(h, s, 0.8 * v); var topColor = ColorExtensions.FromHSV(h, 0.5 * s, Math.Min(1, 1.5 * v + 0.1)); var bigTimerGradiantBrush = new LinearGradientBrush( new PointF(BigTextLabel.X, BigTextLabel.Y), new PointF(BigTextLabel.X, BigTextLabel.Y + ascent + descent), topColor, bottomColor); var smallTimerGradiantBrush = new LinearGradientBrush( new PointF(SmallTextLabel.X, SmallTextLabel.Y), new PointF(SmallTextLabel.X, SmallTextLabel.Y + ascent + descent + smallFont.Size - bigFont.Size), topColor, bottomColor); BigTextLabel.Brush = bigTimerGradiantBrush; SmallTextLabel.Brush = smallTimerGradiantBrush; } BigTextLabel.Draw(g); SmallTextLabel.Draw(g); }
private void GetGradientColors(Color baseColor, out Color topColor, out Color bottomColor) { double h, s, v; baseColor.ToHSV(out h, out s, out v); bottomColor = ColorExtensions.FromHSV(h, s, 0.8 * v); topColor = ColorExtensions.FromHSV(h, 0.5 * s, Math.Min(1, 1.5 * v + 0.1)); }
private static Color GetBestSegmentColor(LiveSplitState state) { if (state.LayoutSettings.UseRainbowColor) { return(ColorExtensions.FromHSV((TripleDateTime.Now.QPCValue.TotalMilliseconds / 6) % 360, 1, 1)); } return(state.LayoutSettings.BestSegmentColor); }
private static Color GetBestSegmentColor(SplitterState state) { if (state.LayoutSettings.UseRainbowColor) { var hue = (((int)DateTime.Now.TimeOfDay.TotalMilliseconds / 100) % 36) * 10; var rainbowColor = ColorExtensions.FromHSV(hue, 1, 1); return(Color.FromArgb((rainbowColor.R * 2 + 255 * 1) / 3, (rainbowColor.G * 2 + 255 * 1) / 3, (rainbowColor.B * 2 + 255 * 1) / 3)); } return(state.LayoutSettings.BestSegmentColor); }
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); } }
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); } }