Exemple #1
0
        protected virtual void DrawFluentButtonBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            var strokeWidth = 1;

            if (IsEnabled)
            {
                canvas.StrokeColor = Colors.Black;
                canvas.FillColor   = BackgroundColor.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
            }
            else
            {
                var disabledColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);
                canvas.StrokeColor = canvas.FillColor = disabledColor;
            }

            canvas.StrokeSize = strokeWidth;

            var x = dirtyRect.X;
            var y = dirtyRect.Y;

            var width  = dirtyRect.Width;
            var height = dirtyRect.Height;

            canvas.DrawRoundedRectangle(x, y, width, height, (float)CornerRadius);

            float margin = strokeWidth * 2;

            canvas.FillRoundedRectangle(x + strokeWidth, y + strokeWidth, width - margin, height - margin, (float)CornerRadius);

            canvas.RestoreState();

            _backgroundRect = new RectangleF(x + strokeWidth, y + strokeWidth, width - margin, height - margin);
        }
        void DrawFluentRadioButtonMark(ICanvas canvas, RectangleF dirtyRect)
        {
            if (IsChecked)
            {
                canvas.SaveState();

                if (IsEnabled)
                {
                    canvas.FillColor = BackgroundColor.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
                }
                else
                {
                    canvas.FillColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);
                }

                var x = 6;
                var y = 6;

                var size = 10;

                canvas.FillEllipse(x, y, size, size);

                canvas.RestoreState();
            }
        }
Exemple #3
0
        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();
        }
Exemple #5
0
        void DrawFluentEntryIndicators(ICanvas canvas, RectangleF dirtyRect)
        {
            if (!string.IsNullOrEmpty(Text))
            {
                canvas.SaveState();

                var iconMarginX = 24;
                var iconMarginY = 10;

                var tX = dirtyRect.Width - iconMarginX;
                var tY = dirtyRect.Y + iconMarginY;

                canvas.Translate(tX, tY);

                var vBuilder = new PathBuilder();
                var path     =
                    vBuilder.BuildPath(
                        "M6.84961 6L12 11.1504L11.1504 12L6 6.84961L0.849609 12L0 11.1504L5.15039 6L0 0.849609L0.849609 0L6 5.15039L11.1504 0L12 0.849609L6.84961 6Z");

                canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Gray1, Material.Color.Gray6);
                canvas.FillPath(path);

                canvas.RestoreState();

                _indicatorRect = new RectangleF(tX, tY, FluentEntryHeight / 2, FluentEntryHeight / 2);
            }
        }
        void DrawFluentEntryIndicators(ICanvas canvas, RectangleF dirtyRect)
        {
            if (!string.IsNullOrEmpty(Text))
            {
                canvas.SaveState();

                var iconMarginX = 24;
                var iconMarginY = 10;

                var tX = dirtyRect.Width - iconMarginX;
                var tY = dirtyRect.Y + iconMarginY;

                canvas.Translate(tX, tY);

                var vBuilder = new PathBuilder();
                var path     = vBuilder.BuildPath(FluentEntryIndicatorIcon);

                canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Gray1, Material.Color.Gray6);
                canvas.FillPath(path);

                canvas.RestoreState();

                _indicatorRect = new RectangleF(tX, tY, FluentEntryHeight / 2, FluentEntryHeight / 2);
            }
        }
        void DrawFluentRadioButtonBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            var strokeWidth = 2;

            canvas.StrokeSize = strokeWidth;

            if (IsEnabled)
            {
                canvas.StrokeColor = BackgroundColor.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
            }
            else
            {
                canvas.StrokeColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);
            }

            var x = dirtyRect.X + strokeWidth / 2;
            var y = dirtyRect.Y + strokeWidth / 2;

            var size = 20;

            canvas.DrawEllipse(x, y, size, size);

            canvas.RestoreState();
        }
Exemple #8
0
        void DrawMaterialEntryIndicators(ICanvas canvas, RectangleF dirtyRect)
        {
            if (!string.IsNullOrEmpty(Text))
            {
                canvas.SaveState();

                float radius = 12f;

                var backgroundMarginX = 24;
                var backgroundMarginY = 28;

                var x = dirtyRect.Width - backgroundMarginX;
                var y = dirtyRect.Y + backgroundMarginY;

                if (FlowDirection == FlowDirection.RightToLeft)
                {
                    x = backgroundMarginX;
                }

                canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Black, Material.Color.White);
                canvas.Alpha     = Application.Current?.RequestedTheme == OSAppTheme.Light ? 0.12f : 0.24f;

                canvas.FillCircle(x, y, radius);

                canvas.RestoreState();

                _indicatorRect = new RectangleF(x - radius, y - radius, radius * 2, radius * 2);

                canvas.SaveState();

                var iconMarginX = 29;
                var iconMarginY = 23;

                var tX = dirtyRect.Width - iconMarginX;
                var tY = dirtyRect.Y + iconMarginY;

                if (FlowDirection == FlowDirection.RightToLeft)
                {
                    iconMarginX = 19;
                    tX          = iconMarginX;
                }

                canvas.Translate(tX, tY);

                var vBuilder = new PathBuilder();
                var path     =
                    vBuilder.BuildPath(
                        "M9.295 7.885C9.68436 8.27436 9.68436 8.90564 9.295 9.295C8.90564 9.68436 8.27436 9.68436 7.885 9.295L5 6.41L2.115 9.295C1.72564 9.68436 1.09436 9.68436 0.705 9.295C0.315639 8.90564 0.315639 8.27436 0.705 7.885L3.59 5L0.705 2.115C0.315639 1.72564 0.31564 1.09436 0.705 0.705C1.09436 0.315639 1.72564 0.315639 2.115 0.705L5 3.59L7.885 0.705C8.27436 0.315639 8.90564 0.31564 9.295 0.705C9.68436 1.09436 9.68436 1.72564 9.295 2.115L6.41 5L9.295 7.885Z");

                canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Black, Material.Color.White);
                canvas.FillPath(path);

                canvas.RestoreState();
            }
        }
Exemple #9
0
        void DrawMaterialEntryIndicators(ICanvas canvas, RectangleF dirtyRect)
        {
            if (!string.IsNullOrEmpty(Text))
            {
                canvas.SaveState();

                float radius = 12f;

                var backgroundMarginX = 24;
                var backgroundMarginY = 28;

                var x = dirtyRect.Width - backgroundMarginX;
                var y = dirtyRect.Y + backgroundMarginY;

                if (FlowDirection == FlowDirection.RightToLeft)
                {
                    x = backgroundMarginX;
                }

                canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Black, Material.Color.White);
                canvas.Alpha     = Application.Current?.RequestedTheme == OSAppTheme.Light ? 0.12f : 0.24f;

                canvas.FillCircle(x, y, radius);

                canvas.RestoreState();

                _indicatorRect = new RectangleF(x - radius, y - radius, radius * 2, radius * 2);

                canvas.SaveState();

                var iconMarginX = 29;
                var iconMarginY = 23;

                var tX = dirtyRect.Width - iconMarginX;
                var tY = dirtyRect.Y + iconMarginY;

                if (FlowDirection == FlowDirection.RightToLeft)
                {
                    iconMarginX = 19;
                    tX          = iconMarginX;
                }

                canvas.Translate(tX, tY);

                var vBuilder = new PathBuilder();
                var path     = vBuilder.BuildPath(MaterialEntryIndicatorIcon);

                canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Black, Material.Color.White);
                canvas.FillPath(path);

                canvas.RestoreState();
            }
        }
Exemple #10
0
        void DrawCupertinoRadioButtonMark(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FillColor = BackgroundColor.ToGraphicsColor(Cupertino.Color.SystemColor.Light.Blue, Cupertino.Color.SystemColor.Dark.Blue);

            var x = 6;
            var y = 7;

            var size = 12;

            canvas.FillOval(x, y, size, size);

            canvas.RestoreState();
        }
        void DrawMaterialRadioButtonMark(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Blue);

            var x = 6;
            var y = 6;

            var size = 10;

            canvas.FillOval(x, y, size, size);

            canvas.RestoreState();
        }
        void DrawCupertinoStepperBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FillColor = BackgroundColor.ToGraphicsColor(Cupertino.Color.Fill.Light.Tertiary, Cupertino.Color.Fill.Dark.Tertiary);

            var x = dirtyRect.X;
            var y = dirtyRect.Y;

            var height = CupertinoStepperHeight;
            var width  = CupertinoStepperWidth;

            canvas.FillRoundedRectangle(x, y, width, height, 7.92f);

            canvas.RestoreState();
        }
        void DrawBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FillColor = BackgroundColor.ToGraphicsColor();

            var x = dirtyRect.X + CanvasDefaults.DefaultShadowBlur;
            var y = dirtyRect.Y + CanvasDefaults.DefaultShadowBlur;

            var height = dirtyRect.Height - CanvasDefaults.DefaultShadowBlur * 2;
            var width  = dirtyRect.Width - CanvasDefaults.DefaultShadowBlur * 2;

            canvas.FillRoundedRectangle(x, y, width, height, (float)CornerRadius.TopLeft, (float)CornerRadius.TopRight, (float)CornerRadius.BottomLeft, (float)CornerRadius.BottomRight);

            canvas.RestoreState();
        }
        void DrawCupertinoEditorBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.White, Material.Color.Black);

            var x = dirtyRect.X;
            var y = dirtyRect.Y;

            var width  = dirtyRect.Width;
            var height = dirtyRect.Height;

            canvas.FillRoundedRectangle(x, y, width, height, 8);

            canvas.RestoreState();
        }
        void DrawMaterialDatePickerBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Gray5, Material.Color.Dark);

            var width = dirtyRect.Width;

            var vBuilder = new PathBuilder();
            var path     =
                vBuilder.BuildPath(
                    $"M0 4C0 1.79086 1.79086 0 4 0H{width - 4}C{width - 2}.209 0 {width} 1.79086 {width} 4V56H0V4Z");

            canvas.FillPath(path);

            canvas.RestoreState();
        }
Exemple #16
0
        void DrawMaterialRadioButtonBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            var strokeWidth = 2;

            canvas.StrokeSize  = strokeWidth;
            canvas.StrokeColor = BackgroundColor.ToGraphicsColor(Material.Color.Blue);

            var x = dirtyRect.X + strokeWidth / 2;
            var y = dirtyRect.Y + strokeWidth / 2;

            var size = 20;

            canvas.DrawEllipse(x, y, size, size);

            canvas.RestoreState();
        }
Exemple #17
0
        void DrawCupertinoButtonBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FillColor = BackgroundColor.ToGraphicsColor(Cupertino.Color.SystemColor.Light.Blue, Cupertino.Color.SystemColor.Dark.Blue);

            var x = dirtyRect.X;
            var y = dirtyRect.Y;

            var width  = dirtyRect.Width;
            var height = dirtyRect.Height;

            canvas.FillRoundedRectangle(x, y, width, height, (float)CornerRadius);

            canvas.RestoreState();

            _backgroundRect = new RectangleF(x, y, width, height);
        }
        void DrawMaterialButtonBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Blue);

            var x = dirtyRect.X;
            var y = dirtyRect.Y;

            var width = dirtyRect.Width - MaterialShadowOffset;

            canvas.SetShadow(new SizeF(0, 1), 3, new GColor(Application.Current?.RequestedTheme == OSAppTheme.Light ? Material.Color.Gray2 : Material.Color.Gray1));

            canvas.FillRoundedRectangle(x, y, width, MaterialBackgroundHeight, (float)CornerRadius);

            canvas.RestoreState();

            _backgroundRect = new RectangleF(x, y, width, MaterialBackgroundHeight);
        }
Exemple #19
0
        void DrawCupertinoRadioButtonBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.StrokeSize  = 2;
            canvas.StrokeColor = BackgroundColor.ToGraphicsColor(Cupertino.Color.SystemColor.Light.Blue, Cupertino.Color.SystemColor.Dark.Blue);

            var marginX = 2;
            var marginY = 3;

            var x = dirtyRect.X + marginX;
            var y = dirtyRect.Y + marginY;

            var size = 20;

            canvas.DrawOval(x, y, size, size);

            canvas.RestoreState();
        }
Exemple #20
0
        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();
        }
        void DrawFluentEditorBackground(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            if (IsEnabled)
            {
                canvas.FillColor = BackgroundColor.ToGraphicsColor(Fluent.Color.Foreground.White, Fluent.Color.Foreground.NeutralPrimaryAlt);
            }
            else
            {
                canvas.FillColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);
            }

            var x = dirtyRect.X;
            var y = dirtyRect.Y;

            var width  = dirtyRect.Width;
            var height = dirtyRect.Height;

            canvas.FillRoundedRectangle(x, y, width, height, 2);

            canvas.RestoreState();
        }