public static void FillRoundedRectangle(this ICanvas target, Rectangle rect, double topLeftCornerRadius, double topRightCornerRadius, double bottomLeftCornerRadius, double bottomRightCornerRadius) { var path = new PathF(); path.AppendRoundedRectangle((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height, (float)topLeftCornerRadius, (float)topRightCornerRadius, (float)bottomLeftCornerRadius, (float)bottomRightCornerRadius); target.FillPath(path); }
public static void FillRoundedRectangle(this ICanvas target, RectangleF rect, float topLeftCornerRadius, float topRightCornerRadius, float bottomLeftCornerRadius, float bottomRightCornerRadius) { var path = new PathF(); path.AppendRoundedRectangle(rect, topLeftCornerRadius, topRightCornerRadius, bottomLeftCornerRadius, bottomRightCornerRadius); target.FillPath(path); }
public override PathF PathForBounds(RectangleF rect) { var path = new PathF(); path.AppendRoundedRectangle(rect, _cornerRadius); return(path); }
public static void DrawRoundedRectangle(this ICanvas target, float x, float y, float width, float height, float topLeftCornerRadius, float topRightCornerRadius, float bottomLeftCornerRadius, float bottomRightCornerRadius) { var path = new PathF(); path.AppendRoundedRectangle(x, y, width, height, topLeftCornerRadius, topRightCornerRadius, bottomLeftCornerRadius, bottomRightCornerRadius); target.DrawPath(path); }
public PathF PathForBounds(Rect rect) { var path = new PathF(); path.AppendRoundedRectangle(rect, (float)RadiusY + (float)RadiusX); return(path); }
public override PathF PathForBounds(Rectangle rect) { var path = new PathF(); var cornerSize = (float)Math.Min(rect.Width, rect.Height) / 2; path.AppendRoundedRectangle(rect, cornerSize); return(path); }
public PathF PathForBounds(Rectangle rect) { var path = new PathF(); path.AppendRoundedRectangle(rect, (float)CornerRadius.TopLeft, (float)CornerRadius.TopRight, (float)CornerRadius.BottomLeft, (float)CornerRadius.BottomRight); return(path); }
public override PathF PathForBounds(Rectangle rect) { var cornerRadius = (float)(Orientation == Orientation.Horizontal ? rect.Height : rect.Width) / 2f; var path = new PathF(); path.AppendRoundedRectangle(rect, cornerRadius); return(path); }
PathF IShape.PathForBounds(Rectangle bounds) { var path = new PathF(); path.AppendRoundedRectangle( bounds, (float)CornerRadius.TopLeft, (float)CornerRadius.TopRight, (float)CornerRadius.BottomLeft, (float)CornerRadius.BottomRight); return(path); }
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); float cornerRadius = (float)Math.Max(RadiusX, RadiusY); // TODO: Create specific Path taking into account RadiusX and RadiusY path.AppendRoundedRectangle(x, y, w, h, cornerRadius); return(path); }
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); float topLeftCornerRadius = (float)CornerRadius.TopLeft; float topRightCornerRadius = (float)CornerRadius.TopRight; float bottomLeftCornerRadius = (float)CornerRadius.BottomLeft; float bottomRightCornerRadius = (float)CornerRadius.BottomRight; path.AppendRoundedRectangle(x, y, w, h, topLeftCornerRadius, topRightCornerRadius, bottomLeftCornerRadius, bottomRightCornerRadius); return(path); }
PathF GetPath(float width, float height, CornerRadius cornerRadius, float strokeThickness) { var path = new PathF(); float x = (float)strokeThickness / 2; float y = (float)strokeThickness / 2; float w = (float)(width - strokeThickness); float h = (float)(height - strokeThickness); float topLeftCornerRadius = (float)cornerRadius.TopLeft; float topRightCornerRadius = (float)cornerRadius.TopRight; float bottomLeftCornerRadius = (float)cornerRadius.BottomLeft; float bottomRightCornerRadius = (float)cornerRadius.BottomRight; path.AppendRoundedRectangle(x, y, w, h, topLeftCornerRadius, topRightCornerRadius, bottomLeftCornerRadius, bottomRightCornerRadius); return(path); }
public void Clip(IRectangleMask mask, DrawContext context) { if (!mask.IsActive) { return; } var bounds = mask.Size.GetDrawRectangle(context.CanvasRect, context.PixelScaling); var topLeft = GetCornerPoint(mask.Corners.TopLeft, bounds, context.PixelScaling); var topRight = GetCornerPoint(mask.Corners.TopRight, bounds, context.PixelScaling); var bottomLeft = GetCornerPoint(mask.Corners.BottomLeft, bounds, context.PixelScaling); var bottomRight = GetCornerPoint(mask.Corners.BottomRight, bounds, context.PixelScaling); var path = new PathF(); path.AppendRoundedRectangle(bounds, topLeft.X, topRight.X, bottomLeft.X, bottomRight.X); using var layout = ShapeMaskLayout.Create(mask, bounds, context, false); context.Canvas.ClipPath(path); }
public static void AppendRoundedRectangle(this PathF path, Rectangle rect, float radius) => path.AppendRoundedRectangle((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height, radius);