TOPasscodeCircleImage.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // TOPasscodeCircleImage.h
  3. //
  4. // Copyright 2017 Timothy Oliver. All rights reserved.
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining a copy
  7. // of this software and associated documentation files (the "Software"), to
  8. // deal in the Software without restriction, including without limitation the
  9. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  10. // sell copies of the Software, and to permit persons to whom the Software is
  11. // furnished to do so, subject to the following conditions:
  12. //
  13. // The above copyright notice and this permission notice shall be included in
  14. // all copies or substantial portions of the Software.
  15. //
  16. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  20. // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
  21. // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. #import <UIKit/UIKit.h>
  23. NS_ASSUME_NONNULL_BEGIN
  24. /**
  25. A subclass of `UIImage` that can procedurally generate both hollow and full circle graphics at any size.
  26. These are used for the 'normal' and 'tapped' states of the passcode circle buttons.
  27. */
  28. @interface TOPasscodeCircleImage : UIImage
  29. /**
  30. Generates and returns a `UIImage` of a filled circle at the specified size.
  31. @param size The diameter of the final circle image
  32. @param inset An inset value that will shrink the size of the circle. This is so it can be overlaid on a hollow circle
  33. without interfering with the anti-aliasing on the outer border.
  34. @param padding External padding around the circle to ensure it won't be clipped by the edge of the layer.
  35. Setting this value will increase the dimensions of the final `UIImage`.
  36. @param antialias Whether the circle boundary will be antialiased (Since antialiasing is unnecessary if this circle will overlay another.)
  37. */
  38. + (UIImage *)circleImageOfSize:(CGFloat)size inset:(CGFloat)inset padding:(CGFloat)padding antialias:(BOOL)antialias;
  39. /**
  40. Generates and returns a `UIImage` of a hollow circle at the specified size.
  41. @param size The diameter of the final circle image
  42. @param strokeWidth The thickness, in points, of the stroke making up the circle image.
  43. @param padding External padding around the circle to ensure it won't be clipped by the edge of the layer.
  44. Setting this value will increase the dimensions of the final `UIImage`.
  45. */
  46. + (UIImage *)hollowCircleImageOfSize:(CGFloat)size strokeWidth:(CGFloat)strokeWidth padding:(CGFloat)padding;
  47. @end
  48. NS_ASSUME_NONNULL_END