Monobjc.ApplicationServices.CGRect.CGRectStandardize C# (CSharp) Method

CGRectStandardize() public static method

Returns a rectangle with a positive width and height.
Original declaration is : CGRect CGRectStandardize ( CGRect rect );
public static CGRectStandardize ( CGRect rect ) : CGRect
rect CGRect The source rectangle.
return CGRect
        public static CGRect CGRectStandardize(CGRect rect)
        {
            bool horiz = (rect.size.width > 0);
            bool vert = (rect.size.height > 0);
            float w = horiz ? rect.size.width : -rect.size.width;
            float h = horiz ? rect.size.height : -rect.size.height;
            float x = horiz ? rect.origin.x : rect.origin.x - w;
            float y = vert ? rect.origin.y : rect.origin.y - h;
            return CGRectMake(x, y, w, h);
        }