Example #1
0
        /// <summary>
        /// make a new instance from Left-Top and size
        /// </summary>
        /// <param name="lt"></param>
        /// <param name="size"></param>
        /// <returns></returns>

        public static LayoutRect From(LayoutPos lt, LayoutSize size)
        {
            return(new LayoutRect
            {
                LT = new LayoutPos
                {
                    X = new LayoutX {
                        Lx = lt.X.Lx
                    },
                    Y = new LayoutY {
                        Ly = lt.Y.Ly
                    },
                },
                RB = new LayoutPos
                {
                    X = new LayoutX {
                        Lx = lt.X.Lx + size.Width.Lx
                    },
                    Y = new LayoutY {
                        Ly = lt.Y.Ly + size.Height.Ly
                    },
                },
            });
        }
Example #2
0
        /// <summary>
        /// make a new instance from center x0, y0 and size
        /// </summary>
        /// <param name="x0">center X (Layout)</param>
        /// <param name="y0">center Y (Layout)</param>
        /// <param name="size"></param>
        /// <returns></returns>

        public static LayoutRect From(double x0, double y0, LayoutSize size)
        {
            return(new LayoutRect
            {
                LT = new LayoutPos
                {
                    X = new LayoutX {
                        Lx = x0
                    },
                    Y = new LayoutY {
                        Ly = y0
                    },
                },
                RB = new LayoutPos
                {
                    X = new LayoutX {
                        Lx = x0 + size.Width.Lx
                    },
                    Y = new LayoutY {
                        Ly = y0 + size.Height.Ly
                    },
                },
            });
        }
Example #3
0
        /// <summary>
        /// make a new instance from center and size
        /// </summary>
        /// <param name="center"></param>
        /// <param name="size"></param>
        /// <returns></returns>

        public static LayoutRect FromCS(LayoutPos center, LayoutSize size)
        {
            return(FromCWH(center, size.Width.Lx, size.Height.Ly));
        }
Example #4
0
 /// <summary>
 /// make a new size instance
 /// </summary>
 /// <returns></returns>
 public LayoutSize ToSize()
 {
     return(LayoutSize.From(Width, Height));
 }
Example #5
0
 /// <summary>
 /// deflate instance
 /// </summary>
 /// <param name="all"></param>
 /// <returns></returns>
 public void Deflate(LayoutSize size)
 {
     LT += size / 2;
     RB -= size / 2;
 }
Example #6
0
 /// <summary>
 /// infrate instance
 /// </summary>
 /// <param name="all"></param>
 /// <returns></returns>
 public void Inflate(LayoutSize size)
 {
     LT -= size / 2.0;
     RB += size / 2.0;
 }