Пример #1
0
        /// <include file="../../../docs/Microsoft.Maui.Controls.Shapes/EllipseGeometry.xml" path="//Member[@MemberName='AppendPath']/Docs" />
        public override void AppendPath(PathF path)
        {
            var radiusX = (float)RadiusX;
            var radiusY = (float)RadiusY;

            path.AppendEllipse((float)Center.X - radiusX, (float)Center.Y - radiusY, radiusX * 2f, radiusY * 2f);
        }
Пример #2
0
        public override PathF PathForBounds(Rectangle rect)
        {
            var path = new PathF();

            path.AppendEllipse(new RectangleF((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height));
            return(path);
        }
Пример #3
0
        public override PathF PathForBounds(RectangleF rect)
        {
            var path = new PathF();

            path.AppendEllipse(rect);
            return(path);
        }
Пример #4
0
        public PathF PathForBounds(Rect rect)
        {
            var path = new PathF();

            path.AppendEllipse(0f, 0f, (float)Width, (float)Height);

            return(path.AsScaledPath((float)Width / (float)rect.Width));
        }
Пример #5
0
        public override PathF PathForBounds(RectangleF rect)
        {
            var size = Math.Min(rect.Width, rect.Height);
            var x    = rect.X + (rect.Width - size) / 2;
            var y    = rect.Y + (rect.Height - size) / 2;
            var path = new PathF();

            path.AppendEllipse(x, y, size, size);
            return(path);
        }
Пример #6
0
        public PathF PathForBounds(Rect rect)
        {
            var path = new PathF();

            var radiusX = (float)RadiusX;
            var radiusY = (float)RadiusY;

            path.AppendEllipse((float)Center.X - radiusX, (float)Center.Y - radiusY, radiusX * 2f, radiusY * 2f);

            return(path);
        }
Пример #7
0
        private void FillSubPaths(ICanvas canvas)
        {
            canvas.StrokeColor = Colors.LightGrey;
            canvas.DrawRectangle(150.5f, 150.5f, 50, 50);
            var path = new PathF();

            path.AppendRectangle(175.5f, 150.5f, 25, 50);
            path.AppendEllipse(175.5f, 150.5f, 25, 50);
            canvas.FillColor = Colors.Black;
            canvas.FillPath(path);
        }
Пример #8
0
        /// <include file="../../../docs/Microsoft.Maui.Controls.Shapes/Ellipse.xml" path="//Member[@MemberName='GetPath']/Docs" />
        public override PathF GetPath()
        {
            var path = new PathF();

            float x = (float)StrokeThickness / 2;
            float y = (float)StrokeThickness / 2;
            float w = (float)(Width - StrokeThickness);
            float h = (float)(Height - StrokeThickness);

            path.AppendEllipse(x, y, w, h);

            return(path);
        }
Пример #9
0
        /// <include file="../../../docs/Microsoft.Maui.Controls.Shapes/EllipseGeometry.xml" path="//Member[@MemberName='AppendPath']/Docs" />
        public override void AppendPath(PathF path)
        {
            double density = 1.0d;

#if ANDROID
            density = DeviceDisplay.MainDisplayInfo.Density;
#endif

            var centerX = (float)(density * RadiusX);
            var centerY = (float)(density * RadiusY);

            var radiusX = (float)(density * RadiusX);
            var radiusY = (float)(density * RadiusY);

            path.AppendEllipse(centerX - radiusX, centerY - radiusY, radiusX * 2f, radiusY * 2f);
        }
        public void Clip(IEllipseMask mask, DrawContext context)
        {
            if (!mask.IsActive)
            {
                return;
            }

            var bounds = mask.Size.GetDrawRectangle(context.CanvasRect, context.PixelScaling);

            var path = new PathF();

            path.AppendEllipse(bounds);

            using var layout = ShapeMaskLayout.Create(mask, bounds, context, false);
            context.Canvas.ClipPath(path);
        }