public static Recti Parse(string str)
        {
            Recti r;

            if (Recti.TryParse(str, out r))
            {
                return(r);
            }
            throw new ArgumentException("Cannot create Recti from '" + str + "'");
        }
예제 #2
0
        public static bool TryParse(string str, out Recti result)
        {
            bool ret = NoesisGUI_PINVOKE.Recti_TryParse(str != null ? str : string.Empty, out result);

            if (NoesisGUI_PINVOKE.SWIGPendingException.Pending)
            {
                throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        public void Expand(Recti rect)
        {
            float right  = Right;
            float bottom = Bottom;

            X      = System.Math.Min(X, rect.X);
            Y      = System.Math.Min(Y, rect.Y);
            Width  = (uint)(System.Math.Max(right, rect.Right) - X);
            Height = (uint)(System.Math.Max(bottom, rect.Bottom) - Y);
        }
        public static bool TryParse(string str, out Recti result)
        {
            bool ret = NoesisGUI_PINVOKE.Recti_TryParse(str != null ? str : string.Empty, out result);

    #if UNITY_EDITOR || NOESIS_API
            if (NoesisGUI_PINVOKE.SWIGPendingException.Pending)
            {
                throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
            }
    #endif
            return(ret);
        }
        public Recti Intersect(Recti rect)
        {
            int  x = rect.Left < Left ? (rect.Right > Left ? Left : 0) : (rect.Left < Right ? rect.Left : 0);
            int  y = rect.Top < Top ? (rect.Bottom > Top ? Top : 0) : (rect.Top < Bottom ? rect.Top : 0);
            uint w = (uint)System.Math.Max(0.0f, (rect.Right > Right ? (rect.Left < Right ? Right : 0) : (rect.Right > Left ? rect.Right : 0)) - x);
            uint h = (uint)System.Math.Max(0.0f, (rect.Bottom > Bottom ? (rect.Top < Bottom ? Bottom : 0) : (rect.Bottom > Top ? rect.Bottom : 0)) - y);

            if (w == 0 || h == 0)
            {
                return(Recti.Empty);
            }
            else
            {
                return(new Recti(x, y, w, h));
            }
        }
 public bool IntersectsWith(Recti rect)
 {
     return(!Intersect(rect).IsEmpty);
 }
 public bool Contains(Recti rect)
 {
     return(rect.Left >= Left && rect.Right <= Right && rect.Top >= Top && rect.Bottom <= Bottom);
 }
 public bool Equals(Recti r)
 {
     return(this == r);
 }
 public Rect(Recti rect) : this((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height)
 {
 }