UIBezierPath.h 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // Kindly stolen from https://github.com/BigZaphod/Chameleon
  2. /*
  3. * Copyright (c) 2011, The Iconfactory. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. *
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. *
  15. * 3. Neither the name of The Iconfactory nor the names of its contributors may
  16. * be used to endorse or promote products derived from this software without
  17. * specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT,
  23. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  24. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  26. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  27. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  28. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #include <TargetConditionals.h>
  31. #if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
  32. #import <Foundation/Foundation.h>
  33. #import <CoreGraphics/CoreGraphics.h>
  34. typedef NS_OPTIONS(NSUInteger, UIRectCorner) {
  35. UIRectCornerTopLeft = 1 << 0,
  36. UIRectCornerTopRight = 1 << 1,
  37. UIRectCornerBottomLeft = 1 << 2,
  38. UIRectCornerBottomRight = 1 << 3,
  39. UIRectCornerAllCorners = UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight
  40. };
  41. @interface UIBezierPath : NSObject <NSCopying>
  42. + (UIBezierPath *)bezierPath;
  43. + (UIBezierPath *)bezierPathWithRect:(CGRect)rect;
  44. + (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rect;
  45. + (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius;
  46. + (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii;
  47. + (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise;
  48. + (UIBezierPath *)bezierPathWithCGPath:(CGPathRef)CGPath;
  49. - (void)moveToPoint:(CGPoint)point;
  50. - (void)addLineToPoint:(CGPoint)point;
  51. - (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise;
  52. - (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2;
  53. - (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint;
  54. - (void)closePath;
  55. - (void)removeAllPoints;
  56. - (void)appendPath:(UIBezierPath *)bezierPath;
  57. - (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase;
  58. - (void)getLineDash:(CGFloat *)pattern count:(NSInteger *)count phase:(CGFloat *)phase;
  59. - (BOOL)containsPoint:(CGPoint)point;
  60. - (void)applyTransform:(CGAffineTransform)transform;
  61. @property (nonatomic) CGPathRef CGPath;
  62. @property (nonatomic, readonly) CGPoint currentPoint;
  63. @property (nonatomic) CGFloat lineWidth;
  64. @property (nonatomic) CGLineCap lineCapStyle;
  65. @property (nonatomic) CGLineJoin lineJoinStyle;
  66. @property (nonatomic) CGFloat miterLimit;
  67. @property (nonatomic) CGFloat flatness;
  68. @property (nonatomic) BOOL usesEvenOddFillRule;
  69. @property (readonly, getter=isEmpty) BOOL empty;
  70. @property (nonatomic, readonly) CGRect bounds;
  71. @end
  72. #endif