QQCornerModel.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // QQCornerModel.h
  3. // QQCorner
  4. //
  5. // Created by 秦琦 on 2018/10/24.
  6. // Copyright © 2018 QinQi. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. struct QQRadius {
  10. CGFloat upLeft; //The radius of upLeft. 左上半径
  11. CGFloat upRight; //The radius of upRight. 右上半径
  12. CGFloat downLeft; //The radius of downLeft. 左下半径
  13. CGFloat downRight; //The radius of downRight. 右下半径
  14. };
  15. typedef struct QQRadius QQRadius;
  16. static QQRadius const QQRadiusZero = (QQRadius){0, 0, 0, 0};
  17. NS_INLINE bool QQRadiusIsEqual(QQRadius radius1, QQRadius radius2) {
  18. return radius1.upLeft == radius2.upLeft && radius1.upRight == radius2.upRight && radius1.downLeft == radius2.downLeft && radius1.downRight == radius2.downRight;
  19. }
  20. NS_INLINE QQRadius QQRadiusMake(CGFloat upLeft, CGFloat upRight, CGFloat downLeft, CGFloat downRight) {
  21. QQRadius radius;
  22. radius.upLeft = upLeft;
  23. radius.upRight = upRight;
  24. radius.downLeft = downLeft;
  25. radius.downRight = downRight;
  26. return radius;
  27. }
  28. NS_INLINE QQRadius QQRadiusMakeSame(CGFloat radius) {
  29. QQRadius result;
  30. result.upLeft = radius;
  31. result.upRight = radius;
  32. result.downLeft = radius;
  33. result.downRight = radius;
  34. return result;
  35. }
  36. typedef NS_ENUM(NSUInteger, QQGradualChangeType) {
  37. QQGradualChangeTypeUpLeftToDownRight = 0,
  38. QQGradualChangeTypeUpToDown,
  39. QQGradualChangeTypeLeftToRight,
  40. QQGradualChangeTypeUpRightToDownLeft
  41. };
  42. @interface QQGradualChangingColor : NSObject
  43. @property (nonatomic, strong) UIColor *fromColor;
  44. @property (nonatomic, strong) UIColor *toColor;
  45. @property (nonatomic, assign) QQGradualChangeType type;
  46. @end
  47. @interface QQCorner : NSObject
  48. /**The radiuses of 4 corners. 4个圆角的半径*/
  49. @property (nonatomic, assign) QQRadius radius;
  50. /**The color that will fill the layer/view. 将要填充layer/view的颜色*/
  51. @property (nonatomic, strong) UIColor *fillColor;
  52. /**The color of the border. 边框颜色*/
  53. @property (nonatomic, strong) UIColor *borderColor;
  54. /**The lineWidth of the border. 边框宽度*/
  55. @property (nonatomic, assign) CGFloat borderWidth;
  56. @end