TOCropViewConstants.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // TOCropViewConstants.h
  3. //
  4. // Copyright 2015-2018 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 <Foundation/Foundation.h>
  23. /**
  24. The shape of the cropping region of this crop view controller
  25. */
  26. typedef NS_ENUM(NSInteger, TOCropViewCroppingStyle) {
  27. TOCropViewCroppingStyleDefault, // The regular, rectangular crop box
  28. TOCropViewCroppingStyleCircular // A fixed, circular crop box
  29. };
  30. /**
  31. Preset values of the most common aspect ratios that can be used to quickly configure
  32. the crop view controller.
  33. */
  34. typedef NS_ENUM(NSInteger, TOCropViewControllerAspectRatioPreset) {
  35. TOCropViewControllerAspectRatioPresetOriginal,
  36. TOCropViewControllerAspectRatioPresetSquare,
  37. TOCropViewControllerAspectRatioPreset3x2,
  38. TOCropViewControllerAspectRatioPreset5x3,
  39. TOCropViewControllerAspectRatioPreset4x3,
  40. TOCropViewControllerAspectRatioPreset5x4,
  41. TOCropViewControllerAspectRatioPreset7x5,
  42. TOCropViewControllerAspectRatioPreset16x9,
  43. TOCropViewControllerAspectRatioPresetCustom
  44. };
  45. /**
  46. Whether the control toolbar is placed at the bottom or the top
  47. */
  48. typedef NS_ENUM(NSInteger, TOCropViewControllerToolbarPosition) {
  49. TOCropViewControllerToolbarPositionBottom, // Bar is placed along the bottom in portrait
  50. TOCropViewControllerToolbarPositionTop // Bar is placed along the top in portrait (Respects the status bar)
  51. };
  52. static inline NSBundle *TO_CROP_VIEW_RESOURCE_BUNDLE_FOR_OBJECT(NSObject *object) {
  53. NSBundle *resourceBundle = nil;
  54. NSBundle *classBundle = [NSBundle bundleForClass:object.class];
  55. NSURL *resourceBundleURL = [classBundle URLForResource:@"TOCropViewControllerBundle" withExtension:@"bundle"];
  56. if (resourceBundleURL) {
  57. resourceBundle = [[NSBundle alloc] initWithURL:resourceBundleURL];
  58. }
  59. else {
  60. resourceBundle = classBundle;
  61. }
  62. return resourceBundle;
  63. }