RectUtil.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2014-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <Foundation/Foundation.h>
  21. @interface RectUtil : NSObject
  22. +(CGRect) setPositionOf: (CGRect) rect x:(CGFloat) x y:(CGFloat) y;
  23. +(CGRect) setPositionOf: (CGRect) rect point:(CGPoint) point;
  24. +(CGRect) setYPositionOf: (CGRect) rect y:(CGFloat) y;
  25. +(CGRect) setXPositionOf: (CGRect) rect x:(CGFloat) x;
  26. +(CGRect) changeSizeOf: (CGRect) rect deltaX:(CGFloat) deltaX deltaY:(CGFloat) deltaY;
  27. +(CGRect) setSizeOf: (CGRect) rect width:(CGFloat) width height:(CGFloat) height;
  28. +(CGRect) setWidthOf: (CGRect) rect width:(CGFloat) width;
  29. +(CGRect) setHeightOf: (CGRect) rect height:(CGFloat) height;
  30. +(BOOL) doRectOverlapXExcludingEdgesLeft: (CGRect) left right: (CGRect) right;
  31. +(CGRect)offsetRect: (CGRect) rect byX: (CGFloat) dx byY: (CGFloat) dy;
  32. +(CGRect)offsetAndResizeRect: (CGRect) rect byX: (CGFloat) dx byY: (CGFloat) dy;
  33. + (CGRect) rectZeroAtCenterOf: (CGRect) rect;
  34. + (CGRect) moveRect: (CGRect) rect to: (CGPoint) point keepingOffset: (CGPoint) diff;
  35. + (CGRect) growRect: (CGRect) rect byDx: (CGFloat) dX byDy: (CGFloat) dY;
  36. + (CGRect) growRectBaseline: (CGRect) rect byDx: (CGFloat) dX byDy: (CGFloat) dY;
  37. + (CGRect) rect: (CGRect) rect centerIn: (CGRect) outerRect;
  38. + (CGRect) rect: (CGRect) rect centerIn: (CGRect) outerRect round: (BOOL) round;
  39. + (CGRect) rect: (CGRect) rect centerVerticalIn: (CGRect) outerRect;
  40. + (CGRect) rect: (CGRect) rect centerVerticalIn: (CGRect) outerRect round: (BOOL) round;
  41. + (CGRect) rect: (CGRect) rect centerHorizontalIn: (CGRect) outerRect;
  42. + (CGRect) rect: (CGRect) rect centerHorizontalIn: (CGRect) outerRect round: (BOOL) round;
  43. + (CGPoint) centerOf: (CGRect) rect;
  44. + (CGFloat) distancePoint: (CGPoint) p1 toPoint: (CGPoint) p2;
  45. + (CGRect) rect: (CGRect) rect alignVerticalWith: (CGRect) outerRect round: (BOOL) round;
  46. + (CGRect) rect: (CGRect) rect centerAlignWith: (CGRect) outerRect round: (BOOL) round;
  47. @end