Esempio n. 1
0
        public override ShapeBorder lerpFrom(ShapeBorder a, float t)
        {
            if (a is StadiumBorder stadiumBorder)
            {
                return(new _StadiumToCircleBorder(
                           side: BorderSide.lerp(stadiumBorder.side, this.side, t),
                           circleness: this.circleness * t
                           ));
            }

            if (a is CircleBorder circleBorder)
            {
                return(new _StadiumToCircleBorder(
                           side: BorderSide.lerp(circleBorder.side, this.side, t),
                           circleness: this.circleness + (1.0f - this.circleness) * (1.0f - t)
                           ));
            }

            if (a is _StadiumToCircleBorder border)
            {
                return(new _StadiumToCircleBorder(
                           side: BorderSide.lerp(border.side, this.side, t),
                           circleness: MathUtils.lerpFloat(border.circleness, this.circleness, t)
                           ));
            }

            return(base.lerpFrom(a, t));
        }
Esempio n. 2
0
        public override ShapeBorder lerpTo(ShapeBorder b, float t)
        {
            if (b is RoundedRectangleBorder rectBorder)
            {
                return(new _RoundedRectangleToCircleBorder(
                           side: BorderSide.lerp(side, rectBorder.side, t),
                           borderRadius: BorderRadius.lerp(borderRadius, rectBorder.borderRadius, t),
                           circleness: circleness * (1.0f - t)
                           ));
            }

            if (b is CircleBorder circleBorder)
            {
                return(new _RoundedRectangleToCircleBorder(
                           side: BorderSide.lerp(side, circleBorder.side, t),
                           borderRadius: borderRadius,
                           circleness: circleness + (1.0f - circleness) * t
                           ));
            }

            if (b is _RoundedRectangleToCircleBorder border)
            {
                return(new _RoundedRectangleToCircleBorder(
                           side: BorderSide.lerp(side, border.side, t),
                           borderRadius: BorderRadius.lerp(borderRadius, border.borderRadius, t),
                           circleness: MathUtils.lerpNullableFloat(circleness, border.circleness, t)
                           ));
            }

            return(base.lerpTo(b, t));
        }
Esempio n. 3
0
        public override ShapeBorder lerpFrom(ShapeBorder a, float t)
        {
            if (a is StadiumBorder stadiumBorder)
            {
                return(new StadiumBorder(side: BorderSide.lerp(stadiumBorder.side, this.side, t)));
            }

            if (a is CircleBorder circleBorder)
            {
                return(new _StadiumToCircleBorder(
                           side: BorderSide.lerp(circleBorder.side, this.side, t),
                           circleness: 1.0f - t
                           ));
            }

            if (a is RoundedRectangleBorder rectBorder)
            {
                return(new _StadiumToRoundedRectangleBorder(
                           side: BorderSide.lerp(rectBorder.side, this.side, t),
                           borderRadius: rectBorder.borderRadius,
                           rectness: 1.0f - t
                           ));
            }

            return(base.lerpFrom(a, t));
        }
Esempio n. 4
0
        public override ShapeBorder lerpTo(ShapeBorder b, float t)
        {
            if (b is StadiumBorder stadiumBorder)
            {
                return(new _StadiumToRoundedRectangleBorder(
                           side: BorderSide.lerp(this.side, stadiumBorder.side, t),
                           borderRadius: this.borderRadius,
                           rectness: this.rectness * (1.0f - t)
                           ));
            }

            if (b is RoundedRectangleBorder rectBorder)
            {
                return(new _StadiumToRoundedRectangleBorder(
                           side: BorderSide.lerp(this.side, rectBorder.side, t),
                           borderRadius: this.borderRadius,
                           rectness: this.rectness + (1.0f - this.rectness) * t
                           ));
            }

            if (b is _StadiumToRoundedRectangleBorder border)
            {
                return(new _StadiumToRoundedRectangleBorder(
                           side: BorderSide.lerp(this.side, border.side, t),
                           borderRadius: BorderRadius.lerp(this.borderRadius, border.borderRadius, t),
                           rectness: MathUtils.lerpFloat(this.rectness, border.rectness, t)
                           ));
            }

            return(base.lerpTo(b, t));
        }
Esempio n. 5
0
        public override ShapeBorder lerpTo(ShapeBorder b, float t)
        {
            if (b is StadiumBorder stadiumBorder)
            {
                return(new _StadiumToCircleBorder(
                           side: BorderSide.lerp(this.side, stadiumBorder.side, t),
                           circleness: this.circleness * (1.0f - t)
                           ));
            }

            if (b is CircleBorder circleBorder)
            {
                return(new _StadiumToCircleBorder(
                           side: BorderSide.lerp(this.side, circleBorder.side, t),
                           circleness: this.circleness + (1.0f - this.circleness) * t
                           ));
            }

            if (b is _StadiumToCircleBorder border)
            {
                return(new _StadiumToCircleBorder(
                           side: BorderSide.lerp(this.side, border.side, t),
                           circleness: MathUtils.lerpFloat(this.circleness, border.circleness, t)
                           ));
            }

            return(base.lerpTo(b, t));
        }
Esempio n. 6
0
        public override ShapeBorder lerpTo(ShapeBorder b, float t)
        {
            if (b is StadiumBorder stadiumBorder)
            {
                return(new StadiumBorder(side: BorderSide.lerp(this.side, stadiumBorder.side, t)));
            }

            if (b is CircleBorder circleBorder)
            {
                return(new _StadiumToCircleBorder(
                           side: BorderSide.lerp(this.side, circleBorder.side, t),
                           circleness: t
                           ));
            }

            if (b is RoundedRectangleBorder rectBorder)
            {
                return(new _StadiumToRoundedRectangleBorder(
                           side: BorderSide.lerp(this.side, rectBorder.side, t),
                           borderRadius: rectBorder.borderRadius,
                           rectness: t
                           ));
            }

            return(base.lerpTo(b, t));
        }
Esempio n. 7
0
        public BorderDirectional(
            BorderSide top,
            BorderSide start,
            BorderSide end,
            BorderSide bottom
            )
        {
            if (top == null)
            {
                this.top = BorderSide.none;
            }

            if (start == null)
            {
                this.start = BorderSide.none;
            }

            if (end == null)
            {
                this.end = BorderSide.none;
            }

            if (bottom == null)
            {
                this.bottom = BorderSide.none;
            }

            this.top    = top;
            this.start  = start;
            this.end    = end;
            this.bottom = bottom;
        }
Esempio n. 8
0
        public override ShapeBorder lerpFrom(ShapeBorder a, float t)
        {
            if (a is StadiumBorder stadiumBorder)
            {
                return(new _StadiumToRoundedRectangleBorder(
                           side: BorderSide.lerp(stadiumBorder.side, side, t),
                           borderRadius: borderRadius,
                           rectness: rectness * t
                           ));
            }

            if (a is RoundedRectangleBorder rectBorder)
            {
                return(new _StadiumToRoundedRectangleBorder(
                           side: BorderSide.lerp(rectBorder.side, side, t),
                           borderRadius: borderRadius,
                           rectness: rectness + (1.0f - rectness) * (1.0f - t)
                           ));
            }

            if (a is _StadiumToRoundedRectangleBorder border)
            {
                return(new _StadiumToRoundedRectangleBorder(
                           side: BorderSide.lerp(border.side, side, t),
                           borderRadius: BorderRadius.lerp(border.borderRadius, borderRadius, t),
                           rectness: MathUtils.lerpNullableFloat(border.rectness, rectness, t)
                           ));
            }

            return(base.lerpFrom(a, t));
        }
Esempio n. 9
0
 public override ShapeBorder lerpFrom(ShapeBorder a, double t)
 {
     if (a is StadiumBorder stadiumBorder)
     {
         return(new _StadiumToRoundedRectangleBorder(
                    side: BorderSide.lerp(stadiumBorder.side, this.side, t),
                    borderRadius: this.borderRadius,
                    rectness: this.rectness * t
                    ));
     }
     if (a is RoundedRectangleBorder rectBorder)
     {
         return(new _StadiumToRoundedRectangleBorder(
                    side: BorderSide.lerp(rectBorder.side, this.side, t),
                    borderRadius: this.borderRadius,
                    rectness: this.rectness + (1.0 - this.rectness) * (1.0 - t)
                    ));
     }
     if (a is _StadiumToRoundedRectangleBorder border)
     {
         return(new _StadiumToRoundedRectangleBorder(
                    side: BorderSide.lerp(border.side, this.side, t),
                    borderRadius: BorderRadius.lerp(border.borderRadius, this.borderRadius, t),
                    rectness: MathUtils.lerpDouble(border.rectness, this.rectness, t)
                    ));
     }
     return(base.lerpFrom(a, t));
 }
Esempio n. 10
0
        public override ShapeBorder lerpFrom(ShapeBorder a, float t)
        {
            if (a is RoundedRectangleBorder rectBorder)
            {
                return(new _RoundedRectangleToCircleBorder(
                           side: BorderSide.lerp(rectBorder.side, this.side, t),
                           borderRadius: BorderRadius.lerp(rectBorder.borderRadius, this.borderRadius, t),
                           circleness: this.circleness * t
                           ));
            }

            if (a is CircleBorder circleBorder)
            {
                return(new _RoundedRectangleToCircleBorder(
                           side: BorderSide.lerp(circleBorder.side, this.side, t),
                           borderRadius: this.borderRadius,
                           circleness: this.circleness + (1.0f - this.circleness) * (1.0f - t)
                           ));
            }

            if (a is _RoundedRectangleToCircleBorder border)
            {
                return(new _RoundedRectangleToCircleBorder(
                           side: BorderSide.lerp(border.side, this.side, t),
                           borderRadius: BorderRadius.lerp(border.borderRadius, this.borderRadius, t),
                           circleness: MathUtils.lerpFloat(border.circleness, this.circleness, t)
                           ));
            }

            return(base.lerpFrom(a, t));
        }
        public override ShapeBorder lerpTo(ShapeBorder b, double t)
        {
            if (b is RoundedRectangleBorder rectBorder)
            {
                return(new _RoundedRectangleToCircleBorder(
                           side: BorderSide.lerp(this.side, rectBorder.side, t),
                           borderRadius: BorderRadius.lerp(this.borderRadius, rectBorder.borderRadius, t),
                           circleness: this.circleness * (1.0 - t)
                           ));
            }

            if (b is CircleBorder circleBorder)
            {
                return(new _RoundedRectangleToCircleBorder(
                           side: BorderSide.lerp(this.side, circleBorder.side, t),
                           borderRadius: this.borderRadius,
                           circleness: this.circleness + (1.0 - this.circleness) * t
                           ));
            }

            if (b is _RoundedRectangleToCircleBorder border)
            {
                return(new _RoundedRectangleToCircleBorder(
                           side: BorderSide.lerp(this.side, border.side, t),
                           borderRadius: BorderRadius.lerp(this.borderRadius, border.borderRadius, t),
                           circleness: MathUtils.lerpDouble(this.circleness, border.circleness, t)
                           ));
            }

            return(base.lerpTo(b, t));
        }
 public ContinuousRectangleBorder(
     BorderSide side           = null,
     BorderRadius borderRadius = null)
 {
     this.side         = side ?? BorderSide.none;
     this.borderRadius = borderRadius ?? BorderRadius.zero;
 }
Esempio n. 13
0
 public _StadiumToCircleBorder(
     BorderSide side   = null,
     double circleness = 0.0
     )
 {
     this.side       = BorderSide.none;
     this.circleness = circleness;
 }
Esempio n. 14
0
 public BeveledRectangleBorder(
     BorderSide side           = null,
     BorderRadius borderRadius = null
     )
 {
     this.side         = side ?? BorderSide.none;
     this.borderRadius = borderRadius ?? BorderRadius.zero;
 }
Esempio n. 15
0
        static void _paintUniformBorderWithRectangle(Canvas canvas, Rect rect, BorderSide side)
        {
            D.assert(side.style != BorderStyle.none);
            double width = side.width;
            Paint  paint = side.toPaint();

            canvas.drawRect(rect.deflate(width / 2.0), paint);
        }
Esempio n. 16
0
 public _StadiumToCircleBorder(
     BorderSide side  = null,
     float circleness = 0.0f
     )
 {
     this.side       = BorderSide.none;
     this.circleness = circleness;
 }
Esempio n. 17
0
        static void _paintUniformBorderWithCircle(Canvas canvas, Rect rect, BorderSide side)
        {
            D.assert(side.style != BorderStyle.none);
            double width  = side.width;
            Paint  paint  = side.toPaint();
            double radius = (rect.shortestSide - width) / 2.0;

            canvas.drawCircle(rect.center, radius, paint);
        }
Esempio n. 18
0
 public static Border symmetric(
     BorderSide vertical   = null,
     BorderSide horizontal = null
     )
 {
     vertical   = vertical ?? BorderSide.none;
     horizontal = horizontal ?? BorderSide.none;
     return(new Border(top: vertical, left: horizontal, right: horizontal, bottom: vertical));
 }
Esempio n. 19
0
        public override ShapeBorder lerpTo(ShapeBorder b, float t)
        {
            if (b is CircleBorder border)
            {
                return(new CircleBorder(side: BorderSide.lerp(side, border.side, t)));
            }

            return(base.lerpTo(b, t));
        }
Esempio n. 20
0
        public override ShapeBorder lerpFrom(ShapeBorder a, float t)
        {
            if (a is CircleBorder border)
            {
                return(new CircleBorder(side: BorderSide.lerp(border.side, side, t)));
            }

            return(base.lerpFrom(a, t));
        }
Esempio n. 21
0
        public static Border all(
            Color color       = null,
            double width      = 1.0,
            BorderStyle style = BorderStyle.solid
            )
        {
            BorderSide side = new BorderSide(color: color, width: width, style: style);

            return(new Border(top: side, right: side, bottom: side, left: side));
        }
Esempio n. 22
0
 public _StadiumToRoundedRectangleBorder(
     BorderSide side           = null,
     BorderRadius borderRadius = null,
     float rectness            = 0.0f
     )
 {
     this.side         = side ?? BorderSide.none;
     this.borderRadius = borderRadius ?? BorderRadius.zero;
     this.rectness     = rectness;
 }
Esempio n. 23
0
 public _RoundedRectangleToCircleBorder(
     BorderSide side           = null,
     BorderRadius borderRadius = null,
     float circleness          = 0.0f
     )
 {
     this.side         = side ?? BorderSide.none;
     this.borderRadius = borderRadius ?? BorderRadius.zero;
     this.circleness   = circleness;
 }
Esempio n. 24
0
        public static Border all(
            Color color       = null,
            float width       = 1.0f,
            BorderStyle style = BorderStyle.solid
            )
        {
            BorderSide side = new BorderSide(color: color, width: width, style: style);

            return(Border.fromBorderSide(side));
        }
Esempio n. 25
0
 public override ShapeBorder lerpFrom(ShapeBorder a, double t)
 {
     if (a is BeveledRectangleBorder border)
     {
         return(new BeveledRectangleBorder(
                    side: BorderSide.lerp(border.side, this.side, t),
                    borderRadius: BorderRadius.lerp(border.borderRadius, this.borderRadius, t)
                    ));
     }
     return(base.lerpFrom(a, t));
 }
Esempio n. 26
0
 public override ShapeBorder lerpTo(ShapeBorder b, double t)
 {
     if (b is BeveledRectangleBorder border)
     {
         return(new BeveledRectangleBorder(
                    side: BorderSide.lerp(this.side, border.side, t),
                    borderRadius: BorderRadius.lerp(this.borderRadius, border.borderRadius, t)
                    ));
     }
     return(base.lerpTo(b, t));
 }
Esempio n. 27
0
 public Border(
     BorderSide top    = null,
     BorderSide right  = null,
     BorderSide bottom = null,
     BorderSide left   = null
     )
 {
     this.top    = top ?? BorderSide.none;
     this.right  = right ?? BorderSide.none;
     this.bottom = bottom ?? BorderSide.none;
     this.left   = left ?? BorderSide.none;
 }
 public override ShapeBorder lerpFrom(ShapeBorder a, float t)
 {
     if (a is ContinuousRectangleBorder)
     {
         return(new ContinuousRectangleBorder(
                    side: BorderSide.lerp((a as ContinuousRectangleBorder).side, this.side, t),
                    borderRadius: BorderRadius.lerp((a as ContinuousRectangleBorder).borderRadius,
                                                    this.borderRadius, t)
                    ));
     }
     return(base.lerpFrom(a, t));
 }
 public override ShapeBorder lerpTo(ShapeBorder b, float t)
 {
     if (b is ContinuousRectangleBorder)
     {
         return(new ContinuousRectangleBorder(
                    side: BorderSide.lerp(this.side, (b as ContinuousRectangleBorder).side, t),
                    borderRadius: BorderRadius.lerp(this.borderRadius,
                                                    (b as ContinuousRectangleBorder).borderRadius, t)
                    ));
     }
     return(base.lerpTo(b, t));
 }
Esempio n. 30
0
 static BorderDirectional merge(BorderDirectional a, BorderDirectional b)
 {
     D.assert(a != null);
     D.assert(b != null);
     D.assert(BorderSide.canMerge(a.top, b.top));
     D.assert(BorderSide.canMerge(a.start, b.start));
     D.assert(BorderSide.canMerge(a.end, b.end));
     D.assert(BorderSide.canMerge(a.bottom, b.bottom));
     return(new BorderDirectional(
                top: BorderSide.merge(a.top, b.top),
                start: BorderSide.merge(a.start, b.start),
                end: BorderSide.merge(a.end, b.end),
                bottom: BorderSide.merge(a.bottom, b.bottom)
                ));
 }