void DrawMaterialSwitchBackground(ICanvas canvas, RectangleF dirtyRect) { canvas.SaveState(); if (IsToggled) { canvas.FillColor = OnColor.ToGraphicsColor(Material.Color.LightBlue); canvas.Alpha = 0.5f; } else { canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Gray2); canvas.Alpha = 1.0f; } var margin = MaterialSwitchBackgroundMargin; var x = dirtyRect.X + margin; var y = dirtyRect.Y + margin; var height = 14; var width = MaterialSwitchBackgroundWidth; canvas.FillRoundedRectangle(x, y, width, height, 10); canvas.RestoreState(); }
void DrawFluentSwitchBackground(ICanvas canvas, RectangleF dirtyRect) { canvas.SaveState(); if (IsEnabled) { if (IsToggled) { canvas.FillColor = OnColor.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary); } else { canvas.FillColor = BackgroundColor.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary); } } else { canvas.FillColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark); } var x = dirtyRect.X; var y = dirtyRect.Y; var height = 20; var width = FluentSwitchBackgroundWidth; canvas.FillRoundedRectangle(x, y, width, height, 10); canvas.RestoreState(); }
void DrawCupertinoSwitchBackground(ICanvas canvas, RectangleF dirtyRect) { canvas.SaveState(); var x = dirtyRect.X; var y = dirtyRect.Y; if (IsToggled) { canvas.FillColor = OnColor.ToGraphicsColor(Cupertino.Color.SystemColor.Light.Green, Cupertino.Color.SystemColor.Dark.Green); } else { canvas.FillColor = BackgroundColor.ToGraphicsColor(Cupertino.Color.SystemGray.Light.Gray4, Cupertino.Color.SystemGray.Dark.Gray4); } var height = 30; var width = CupertinoSwitchBackgroundWidth; canvas.FillRoundedRectangle(x, y, width, height, 36.5f); canvas.RestoreState(); }