public static BoxShadows Parse(string s) { var sp = s.Split(s_Separators, StringSplitOptions.RemoveEmptyEntries); if (sp.Length == 0 || (sp.Length == 1 && (string.IsNullOrWhiteSpace(sp[0]) || sp[0] == "none"))) { return(new BoxShadows()); } var first = BoxShadow.Parse(sp[0]); if (sp.Length == 1) { return(new BoxShadows(first)); } var rest = new BoxShadow[sp.Length - 1]; for (var c = 0; c < rest.Length; c++) { rest[c] = BoxShadow.Parse(sp[c + 1]); } return(new BoxShadows(first, rest)); }
/// <summary> /// Draws a rectangle with the specified Brush and Pen. /// </summary> /// <param name="brush">The brush used to fill the rectangle, or <c>null</c> for no fill.</param> /// <param name="pen">The pen used to stroke the rectangle, or <c>null</c> for no stroke.</param> /// <param name="rect">The rectangle bounds.</param> /// <param name="radiusX">The radius in the X dimension of the rounded corners. /// This value will be clamped to the range of 0 to Width/2 /// </param> /// <param name="radiusY">The radius in the Y dimension of the rounded corners. /// This value will be clamped to the range of 0 to Height/2 /// </param> /// <param name="boxShadow">Box shadow effect parameters</param> /// <remarks> /// The brush and the pen can both be null. If the brush is null, then no fill is performed. /// If the pen is null, then no stoke is performed. If both the pen and the brush are null, then the drawing is not visible. /// </remarks> public void DrawRectangle(IBrush brush, IPen pen, Rect rect, double radiusX = 0, double radiusY = 0, BoxShadow boxShadow = default) { if (brush == null && !PenIsVisible(pen)) { return; } if (Math.Abs(radiusX) > double.Epsilon) { radiusX = Math.Min(radiusX, rect.Width / 2); } if (Math.Abs(radiusY) > double.Epsilon) { radiusY = Math.Min(radiusY, rect.Height / 2); } PlatformImpl.DrawRectangle(brush, pen, new RoundedRect(rect, radiusX, radiusY), boxShadow); }
public BoxShadows(BoxShadow first, BoxShadow[] rest) { _first = first; _list = rest; Count = 1 + (rest?.Length ?? 0); }
public BoxShadows(BoxShadow shadow) { _first = shadow; _list = null; Count = _first.IsEmpty ? 0 : 1; }
public BoxShadows(BoxShadow shadow) { _first = shadow; _list = null; Count = 1; }