Esempio n. 1
0
        private SkiaGeometrySource2D GetGeometry(Size finalSize)
        {
            var strokeThickness = StrokeThickness;
            var radiusX         = RadiusX;
            var radiusY         = RadiusY;

            var offset = new Vector2((float)(strokeThickness * 0.5), (float)(strokeThickness * 0.5));
            var size   = new Vector2((float)finalSize.Width, (float)finalSize.Height);

            SkiaGeometrySource2D geometry;

            if (radiusX == 0 || radiusY == 0)
            {
                // Simple rectangle
                geometry = new SkiaGeometrySource2D(
                    CompositionGeometry.BuildRectangleGeometry(
                        offset,
                        size));
            }
            else
            {
                // Complex rectangle
                geometry = new SkiaGeometrySource2D(
                    CompositionGeometry.BuildRoundedRectangleGeometry(
                        offset,
                        size,
                        new Vector2((float)radiusX, (float)radiusY)));
            }

            return(geometry);
        }
Esempio n. 2
0
 internal override SKPath GetSKPath() =>
 CompositionGeometry.BuildRectangleGeometry(offset: new Vector2((float)Rect.X, (float)Rect.Y), size: new Vector2((float)Rect.Width, (float)Rect.Height));