@onekeyfe/react-native-image-crop-picker 3.0.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +83 -0
  3. package/ReactNativeImageCropPicker.podspec +40 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +144 -0
  6. package/android/gradle.properties +4 -0
  7. package/android/src/main/AndroidManifest.xml +24 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerException.kt +45 -0
  10. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerImageProcessor.kt +308 -0
  11. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerSession.kt +297 -0
  12. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ReactNativeImageCropPicker.kt +69 -0
  13. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ReactNativeImageCropPickerPackage.kt +24 -0
  14. package/ios/ImageCropPickerError.swift +57 -0
  15. package/ios/ImageCropPickerImageProcessor.swift +343 -0
  16. package/ios/ImageCropPickerSession.swift +407 -0
  17. package/ios/ReactNativeImageCropPicker.swift +65 -0
  18. package/ios/TOCropViewController/Categories/UIImage+CropRotate.h +39 -0
  19. package/ios/TOCropViewController/Categories/UIImage+CropRotate.m +94 -0
  20. package/ios/TOCropViewController/Constants/TOCropViewConstants.h +63 -0
  21. package/ios/TOCropViewController/LICENSE +21 -0
  22. package/ios/TOCropViewController/Models/TOActivityCroppedImageProvider.h +38 -0
  23. package/ios/TOCropViewController/Models/TOActivityCroppedImageProvider.m +73 -0
  24. package/ios/TOCropViewController/Models/TOCropViewControllerAspectRatioPreset.h +64 -0
  25. package/ios/TOCropViewController/Models/TOCropViewControllerAspectRatioPreset.m +121 -0
  26. package/ios/TOCropViewController/Models/TOCropViewControllerTransitioning.h +49 -0
  27. package/ios/TOCropViewController/Models/TOCropViewControllerTransitioning.m +125 -0
  28. package/ios/TOCropViewController/Models/TOCroppedImageAttributes.h +38 -0
  29. package/ios/TOCropViewController/Models/TOCroppedImageAttributes.m +45 -0
  30. package/ios/TOCropViewController/Resources/Base.lproj/TOCropViewControllerLocalizable.strings +8 -0
  31. package/ios/TOCropViewController/Resources/PrivacyInfo.xcprivacy +14 -0
  32. package/ios/TOCropViewController/Resources/ar.lproj/TOCropViewControllerLocalizable.strings +9 -0
  33. package/ios/TOCropViewController/Resources/ca.lproj/TOCropViewControllerLocalizable.strings +8 -0
  34. package/ios/TOCropViewController/Resources/cs.lproj/TOCropViewControllerLocalizable.strings +8 -0
  35. package/ios/TOCropViewController/Resources/da-DK.lproj/TOCropViewControllerLocalizable.strings +8 -0
  36. package/ios/TOCropViewController/Resources/de.lproj/TOCropViewControllerLocalizable.strings +8 -0
  37. package/ios/TOCropViewController/Resources/en.lproj/TOCropViewControllerLocalizable.strings +8 -0
  38. package/ios/TOCropViewController/Resources/es.lproj/TOCropViewControllerLocalizable.strings +8 -0
  39. package/ios/TOCropViewController/Resources/fa-IR.lproj/TOCropViewControllerLocalizable.strings +8 -0
  40. package/ios/TOCropViewController/Resources/fa.lproj/TOCropViewControllerLocalizable.strings +8 -0
  41. package/ios/TOCropViewController/Resources/fi.lproj/TOCropViewControllerLocalizable.strings +8 -0
  42. package/ios/TOCropViewController/Resources/fr.lproj/TOCropViewControllerLocalizable.strings +8 -0
  43. package/ios/TOCropViewController/Resources/hu.lproj/TOCropViewControllerLocalizable.strings +9 -0
  44. package/ios/TOCropViewController/Resources/id.lproj/TOCropViewControllerLocalizable.strings +8 -0
  45. package/ios/TOCropViewController/Resources/it.lproj/TOCropViewControllerLocalizable.strings +8 -0
  46. package/ios/TOCropViewController/Resources/ja.lproj/TOCropViewControllerLocalizable.strings +8 -0
  47. package/ios/TOCropViewController/Resources/ko.lproj/TOCropViewControllerLocalizable.strings +8 -0
  48. package/ios/TOCropViewController/Resources/ms.lproj/TOCropViewControllerLocalizable.strings +8 -0
  49. package/ios/TOCropViewController/Resources/nl.lproj/TOCropViewControllerLocalizable.strings +8 -0
  50. package/ios/TOCropViewController/Resources/pl.lproj/TOCropViewControllerLocalizable.strings +8 -0
  51. package/ios/TOCropViewController/Resources/pt-BR.lproj/TOCropViewControllerLocalizable.strings +8 -0
  52. package/ios/TOCropViewController/Resources/pt.lproj/TOCropViewControllerLocalizable.strings +8 -0
  53. package/ios/TOCropViewController/Resources/ro.lproj/TOCropViewControllerLocalizable.strings +8 -0
  54. package/ios/TOCropViewController/Resources/ru.lproj/TOCropViewControllerLocalizable.strings +8 -0
  55. package/ios/TOCropViewController/Resources/sk.lproj/TOCropViewControllerLocalizable.strings +8 -0
  56. package/ios/TOCropViewController/Resources/tr.lproj/TOCropViewControllerLocalizable.strings +9 -0
  57. package/ios/TOCropViewController/Resources/uk.lproj/TOCropViewControllerLocalizable.strings +8 -0
  58. package/ios/TOCropViewController/Resources/vi.lproj/TOCropViewControllerLocalizable.strings +9 -0
  59. package/ios/TOCropViewController/Resources/zh-Hans.lproj/TOCropViewControllerLocalizable.strings +9 -0
  60. package/ios/TOCropViewController/Resources/zh-Hant.lproj/TOCropViewControllerLocalizable.strings +9 -0
  61. package/ios/TOCropViewController/TOCropViewController.h +479 -0
  62. package/ios/TOCropViewController/TOCropViewController.m +1355 -0
  63. package/ios/TOCropViewController/Views/TOCropOverlayView.h +43 -0
  64. package/ios/TOCropViewController/Views/TOCropOverlayView.m +240 -0
  65. package/ios/TOCropViewController/Views/TOCropScrollView.h +39 -0
  66. package/ios/TOCropViewController/Views/TOCropScrollView.m +48 -0
  67. package/ios/TOCropViewController/Views/TOCropToolbar.h +104 -0
  68. package/ios/TOCropViewController/Views/TOCropToolbar.m +783 -0
  69. package/ios/TOCropViewController/Views/TOCropView.h +311 -0
  70. package/ios/TOCropViewController/Views/TOCropView.m +1787 -0
  71. package/lib/module/ReactNativeImageCropPicker.nitro.js +4 -0
  72. package/lib/module/ReactNativeImageCropPicker.nitro.js.map +1 -0
  73. package/lib/module/index.js +83 -0
  74. package/lib/module/index.js.map +1 -0
  75. package/lib/module/package.json +1 -0
  76. package/lib/typescript/package.json +1 -0
  77. package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts +54 -0
  78. package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts.map +1 -0
  79. package/lib/typescript/src/index.d.ts +31 -0
  80. package/lib/typescript/src/index.d.ts.map +1 -0
  81. package/nitro.json +23 -0
  82. package/nitrogen/generated/android/c++/JCropRect.hpp +69 -0
  83. package/nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.cpp +125 -0
  84. package/nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.hpp +66 -0
  85. package/nitrogen/generated/android/c++/JImageCropPickerOptions.hpp +154 -0
  86. package/nitrogen/generated/android/c++/JPickedImage.hpp +88 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/CropRect.kt +66 -0
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/HybridReactNativeImageCropPickerSpec.kt +69 -0
  89. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerOptions.kt +171 -0
  90. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/PickedImage.kt +86 -0
  91. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/reactnativeimagecroppickerOnLoad.kt +35 -0
  92. package/nitrogen/generated/android/reactnativeimagecroppicker+autolinking.cmake +81 -0
  93. package/nitrogen/generated/android/reactnativeimagecroppicker+autolinking.gradle +27 -0
  94. package/nitrogen/generated/android/reactnativeimagecroppickerOnLoad.cpp +54 -0
  95. package/nitrogen/generated/android/reactnativeimagecroppickerOnLoad.hpp +34 -0
  96. package/nitrogen/generated/ios/ReactNativeImageCropPicker+autolinking.rb +62 -0
  97. package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.cpp +57 -0
  98. package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.hpp +221 -0
  99. package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Umbrella.hpp +55 -0
  100. package/nitrogen/generated/ios/ReactNativeImageCropPickerAutolinking.mm +33 -0
  101. package/nitrogen/generated/ios/ReactNativeImageCropPickerAutolinking.swift +26 -0
  102. package/nitrogen/generated/ios/c++/HybridReactNativeImageCropPickerSpecSwift.cpp +11 -0
  103. package/nitrogen/generated/ios/c++/HybridReactNativeImageCropPickerSpecSwift.hpp +116 -0
  104. package/nitrogen/generated/ios/swift/CropRect.swift +44 -0
  105. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  106. package/nitrogen/generated/ios/swift/Func_void_PickedImage.swift +46 -0
  107. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  108. package/nitrogen/generated/ios/swift/HybridReactNativeImageCropPickerSpec.swift +58 -0
  109. package/nitrogen/generated/ios/swift/HybridReactNativeImageCropPickerSpec_cxx.swift +202 -0
  110. package/nitrogen/generated/ios/swift/ImageCropPickerOptions.swift +474 -0
  111. package/nitrogen/generated/ios/swift/PickedImage.swift +96 -0
  112. package/nitrogen/generated/shared/c++/CropRect.hpp +95 -0
  113. package/nitrogen/generated/shared/c++/HybridReactNativeImageCropPickerSpec.cpp +24 -0
  114. package/nitrogen/generated/shared/c++/HybridReactNativeImageCropPickerSpec.hpp +71 -0
  115. package/nitrogen/generated/shared/c++/ImageCropPickerOptions.hpp +180 -0
  116. package/nitrogen/generated/shared/c++/PickedImage.hpp +114 -0
  117. package/package.json +173 -0
  118. package/src/ReactNativeImageCropPicker.nitro.ts +72 -0
  119. package/src/index.tsx +134 -0
@@ -0,0 +1,479 @@
1
+ //
2
+ // TOCropViewController.h
3
+ //
4
+ // Copyright 2015-2026 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
+
23
+ #import <UIKit/UIKit.h>
24
+
25
+ #if !__has_include(<TOCropViewController/TOCropViewConstants.h>)
26
+ #import "TOCropToolbar.h"
27
+ #import "TOCropView.h"
28
+ #import "TOCropViewConstants.h"
29
+ #import "TOCropViewControllerAspectRatioPreset.h"
30
+ #else
31
+ #import <TOCropViewController/TOCropToolbar.h>
32
+ #import <TOCropViewController/TOCropView.h>
33
+ #import <TOCropViewController/TOCropViewConstants.h>
34
+ #import <TOCropViewController/TOCropViewControllerAspectRatioPreset.h>
35
+ #endif
36
+
37
+ @class TOCropViewController;
38
+
39
+ ///------------------------------------------------
40
+ /// @name Delegate
41
+ ///------------------------------------------------
42
+
43
+ @protocol TOCropViewControllerDelegate <NSObject>
44
+ @optional
45
+
46
+ /**
47
+ Called when the user has committed the crop action, and provides
48
+ just the cropping rectangle.
49
+
50
+ @param cropRect A rectangle indicating the crop region of the image the user chose (In the original image's local co-ordinate space)
51
+ @param angle The angle of the image when it was cropped
52
+ */
53
+ - (void)cropViewController:(nonnull TOCropViewController *)cropViewController
54
+ didCropImageToRect:(CGRect)cropRect
55
+ angle:(NSInteger)angle;
56
+
57
+ /**
58
+ Called when the user has committed the crop action, and provides
59
+ both the original image with crop co-ordinates.
60
+
61
+ @param image The newly cropped image.
62
+ @param cropRect A rectangle indicating the crop region of the image the user chose (In the original image's local co-ordinate space)
63
+ @param angle The angle of the image when it was cropped
64
+ */
65
+ - (void)cropViewController:(nonnull TOCropViewController *)cropViewController
66
+ didCropToImage:(nonnull UIImage *)image
67
+ withRect:(CGRect)cropRect
68
+ angle:(NSInteger)angle;
69
+
70
+ /**
71
+ If the cropping style is set to circular, implementing this delegate will return a circle-cropped version of the selected
72
+ image, as well as it's cropping co-ordinates
73
+
74
+ @param image The newly cropped image, clipped to a circle shape
75
+ @param cropRect A rectangle indicating the crop region of the image the user chose (In the original image's local co-ordinate space)
76
+ @param angle The angle of the image when it was cropped
77
+ */
78
+ - (void)cropViewController:(nonnull TOCropViewController *)cropViewController
79
+ didCropToCircularImage:(nonnull UIImage *)image
80
+ withRect:(CGRect)cropRect
81
+ angle:(NSInteger)angle;
82
+
83
+ /**
84
+ If implemented, when the user hits cancel, or completes a
85
+ UIActivityViewController operation, this delegate will be called,
86
+ giving you a chance to manually dismiss the view controller
87
+
88
+ @param cancelled Whether a cropping action was actually performed, or if the user explicitly hit 'Cancel'
89
+
90
+ */
91
+ - (void)cropViewController:(nonnull TOCropViewController *)cropViewController
92
+ didFinishCancelled:(BOOL)cancelled;
93
+
94
+ @end
95
+
96
+ @interface TOCropViewController : UIViewController
97
+
98
+ /**
99
+ The original, uncropped image that was passed to this controller.
100
+ */
101
+ @property (nonnull, nonatomic, readonly) UIImage *image;
102
+
103
+ /**
104
+ The minimum croping aspect ratio. If set, user is prevented from
105
+ setting cropping rectangle to lower aspect ratio than defined by the parameter.
106
+ */
107
+ @property (nonatomic, assign) CGFloat minimumAspectRatio;
108
+
109
+ /**
110
+ The view controller's delegate that will receive the resulting
111
+ cropped image, as well as crop information.
112
+ */
113
+ @property (nullable, nonatomic, weak) id<TOCropViewControllerDelegate> delegate;
114
+
115
+ /**
116
+ If true, when the user hits 'Done', a UIActivityController will appear
117
+ before the view controller ends.
118
+ */
119
+ @property (nonatomic, assign) BOOL showActivitySheetOnDone;
120
+
121
+ /**
122
+ The crop view managed by this view controller.
123
+ */
124
+ @property (nonnull, nonatomic, strong, readonly) TOCropView *cropView;
125
+
126
+ /**
127
+ In the coordinate space of the image itself, the region that is currently
128
+ being highlighted by the crop box.
129
+
130
+ This property can be set before the controller is presented to have
131
+ the image 'restored' to a previous cropping layout.
132
+ */
133
+ @property (nonatomic, assign) CGRect imageCropFrame;
134
+
135
+ /**
136
+ The angle in which the image is rotated in the crop view.
137
+ This can only be in 90 degree increments (eg, 0, 90, 180, 270).
138
+
139
+ This property can be set before the controller is presented to have
140
+ the image 'restored' to a previous cropping layout.
141
+ */
142
+ @property (nonatomic, assign) NSInteger angle;
143
+
144
+ /**
145
+ The toolbar view managed by this view controller.
146
+ */
147
+ @property (nonnull, nonatomic, strong, readonly) TOCropToolbar *toolbar;
148
+
149
+ /**
150
+ The cropping style of this particular crop view controller
151
+ */
152
+ @property (nonatomic, readonly) TOCropViewCroppingStyle croppingStyle;
153
+
154
+ /**
155
+ A choice from one of the pre-defined aspect ratio presets
156
+ */
157
+ @property (nonatomic, assign) CGSize aspectRatioPreset;
158
+
159
+ /**
160
+ Title label which can be used to show instruction on the top of the crop view controller
161
+ */
162
+ @property (nullable, nonatomic, readonly) UILabel *titleLabel;
163
+
164
+ /**
165
+ Title for the 'Done' button.
166
+ Setting this will override the Default which is a localized string for "Done".
167
+ */
168
+ @property (nullable, nonatomic, copy) NSString *doneButtonTitle;
169
+
170
+ /**
171
+ Title for the 'Cancel' button.
172
+ Setting this will override the Default which is a localized string for "Cancel".
173
+ */
174
+ @property (nullable, nonatomic, copy) NSString *cancelButtonTitle;
175
+
176
+ /**
177
+ If true, button icons are visible in portairt instead button text.
178
+
179
+ Default is NO. Has no effect on iOS 26 and up, where the toolbar is always icon-only.
180
+ */
181
+ @property (nonatomic, assign) BOOL showOnlyIcons;
182
+
183
+ /**
184
+ Color for the 'Done' button.
185
+ Setting this will override the default color.
186
+ */
187
+ @property (null_resettable, nonatomic, copy) UIColor *doneButtonColor;
188
+
189
+ /**
190
+ Color for the 'Cancel' button.
191
+ Setting this will override the default color.
192
+ */
193
+ @property (nullable, nonatomic, copy) UIColor *cancelButtonColor;
194
+
195
+ /**
196
+ Shows a confirmation dialog when the user hits 'Cancel' and there are pending changes.
197
+ (Default is NO)
198
+ */
199
+ @property (nonatomic, assign) BOOL showCancelConfirmationDialog;
200
+
201
+ /**
202
+ If true, a custom aspect ratio is set, and the aspectRatioLockEnabled is set to YES, the crop box
203
+ will swap it's dimensions depending on portrait or landscape sized images.
204
+ This value also controls whether the dimensions can swap when the image is rotated.
205
+
206
+ Default is NO.
207
+ */
208
+ @property (nonatomic, assign) BOOL aspectRatioLockDimensionSwapEnabled;
209
+
210
+ /**
211
+ If true, while it can still be resized, the crop box will be locked to its current aspect ratio.
212
+
213
+ If this is set to YES, and `resetAspectRatioEnabled` is set to NO, then the aspect ratio
214
+ button will automatically be hidden from the toolbar.
215
+
216
+ Default is NO.
217
+ */
218
+ @property (nonatomic, assign) BOOL aspectRatioLockEnabled;
219
+
220
+ /**
221
+ If true, tapping the reset button will also reset the aspect ratio back to the image
222
+ default ratio. Otherwise, the reset will just zoom out to the current aspect ratio.
223
+
224
+ If this is set to NO, and `aspectRatioLockEnabled` is set to YES, then the aspect ratio
225
+ button will automatically be hidden from the toolbar.
226
+
227
+ Default is YES
228
+ */
229
+ @property (nonatomic, assign) BOOL resetAspectRatioEnabled;
230
+
231
+ /**
232
+ The position of the Toolbar the default value is `TOCropViewControllerToolbarPositionBottom`.
233
+ */
234
+ @property (nonatomic, assign) TOCropViewControllerToolbarPosition toolbarPosition;
235
+
236
+ /**
237
+ When disabled, an additional rotation button that rotates the canvas in
238
+ 90-degree segments in a clockwise direction is shown in the toolbar.
239
+
240
+ Default is NO.
241
+ */
242
+ @property (nonatomic, assign) BOOL rotateClockwiseButtonHidden;
243
+
244
+ /*
245
+ If this controller is embedded in UINavigationController its navigation bar
246
+ is hidden by default. Set this property to false to show the navigation bar.
247
+ This must be set before this controller is presented.
248
+ */
249
+ @property (nonatomic, assign) BOOL hidesNavigationBar;
250
+
251
+ /**
252
+ When enabled, hides the rotation button, as well as the alternative rotation
253
+ button visible when `showClockwiseRotationButton` is set to YES.
254
+
255
+ Default is NO.
256
+ */
257
+ @property (nonatomic, assign) BOOL rotateButtonsHidden;
258
+
259
+ /**
260
+ When enabled, hides the 'Reset' button on the toolbar.
261
+
262
+ Default is NO.
263
+ */
264
+ @property (nonatomic, assign) BOOL resetButtonHidden;
265
+ /**
266
+ When enabled, hides the 'Aspect Ratio Picker' button on the toolbar.
267
+
268
+ Default is NO.
269
+ */
270
+ @property (nonatomic, assign) BOOL aspectRatioPickerButtonHidden;
271
+
272
+ /**
273
+ When enabled, hides the 'Done' button on the toolbar.
274
+
275
+ Default is NO.
276
+ */
277
+ @property (nonatomic, assign) BOOL doneButtonHidden;
278
+
279
+ /**
280
+ When enabled, hides the 'Cancel' button on the toolbar.
281
+
282
+ Default is NO.
283
+ */
284
+ @property (nonatomic, assign) BOOL cancelButtonHidden;
285
+
286
+ /**
287
+ When enabled, the toolbar is displayed in RTL layout.
288
+
289
+ Default is NO.
290
+ */
291
+ @property (nonatomic, assign) BOOL reverseContentLayout;
292
+
293
+ /**
294
+ If `showActivitySheetOnDone` is true, then these activity items will
295
+ be supplied to that UIActivityViewController in addition to the
296
+ `TOActivityCroppedImageProvider` object.
297
+ */
298
+ @property (nullable, nonatomic, strong) NSArray *activityItems;
299
+
300
+ /**
301
+ If `showActivitySheetOnDone` is true, then you may specify any
302
+ custom activities your app implements in this array. If your activity requires
303
+ access to the cropping information, it can be accessed in the supplied
304
+ `TOActivityCroppedImageProvider` object
305
+ */
306
+ @property (nullable, nonatomic, strong) NSArray<UIActivity *> *applicationActivities;
307
+
308
+ /**
309
+ If `showActivitySheetOnDone` is true, then you may expliclty
310
+ set activities that won't appear in the share sheet here.
311
+ */
312
+ @property (nullable, nonatomic, strong) NSArray<UIActivityType> *excludedActivityTypes;
313
+
314
+ /**
315
+ An array of `TOCropViewControllerAspectRatioPreset` enum values denoting which
316
+ aspect ratios the crop view controller may display (Default is nil. All are shown)
317
+ */
318
+ @property (nullable, nonatomic, strong) NSArray<TOCropViewControllerAspectRatioPreset *> *allowedAspectRatios;
319
+
320
+ /**
321
+ Called when the user hits the Done button.
322
+ */
323
+ @property (nullable, nonatomic, copy) void (^onDidTapDone)(void);
324
+
325
+ /**
326
+ When the user hits cancel, or completes a
327
+ UIActivityViewController operation, this block will be called,
328
+ giving you a chance to manually dismiss the view controller
329
+ */
330
+ @property (nullable, nonatomic, strong) void (^onDidFinishCancelled)(BOOL isFinished);
331
+
332
+ /**
333
+ Called when the user has committed the crop action, and provides
334
+ just the cropping rectangle.
335
+
336
+ @param cropRect A rectangle indicating the crop region of the image the user chose
337
+ (In the original image's local co-ordinate space)
338
+ @param angle The angle of the image when it was cropped
339
+ */
340
+ @property (nullable, nonatomic, strong) void (^onDidCropImageToRect)(CGRect cropRect, NSInteger angle);
341
+
342
+ /**
343
+ Called when the user has committed the crop action, and provides
344
+ both the cropped image with crop co-ordinates.
345
+
346
+ @param image The newly cropped image.
347
+ @param cropRect A rectangle indicating the crop region of the image the user chose
348
+ (In the original image's local co-ordinate space)
349
+ @param angle The angle of the image when it was cropped
350
+ */
351
+ @property (nullable, nonatomic, strong) void (^onDidCropToRect)(UIImage *_Nonnull image, CGRect cropRect, NSInteger angle);
352
+
353
+ /**
354
+ If the cropping style is set to circular, this block will return a circle-cropped version of the selected
355
+ image, as well as it's cropping co-ordinates
356
+
357
+ @param image The newly cropped image, clipped to a circle shape
358
+ @param cropRect A rectangle indicating the crop region of the image the user chose
359
+ (In the original image's local co-ordinate space)
360
+ @param angle The angle of the image when it was cropped
361
+ */
362
+ @property (nullable, nonatomic, strong) void (^onDidCropToCircleImage)(UIImage *_Nonnull image, CGRect cropRect, NSInteger angle);
363
+
364
+ ///------------------------------------------------
365
+ /// @name Object Creation
366
+ ///------------------------------------------------
367
+
368
+ /**
369
+ Creates a new instance of a crop view controller with the supplied image
370
+
371
+ @param image The image that will be used to crop.
372
+ */
373
+ - (nonnull instancetype)initWithImage:(nonnull UIImage *)image NS_SWIFT_NAME(init(image:));
374
+
375
+ /**
376
+ Creates a new instance of a crop view controller with the supplied image and cropping style
377
+
378
+ @param style The cropping style that will be used with this view controller (eg, rectangular, or circular)
379
+ @param image The image that will be cropped
380
+ */
381
+ - (nonnull instancetype)initWithCroppingStyle:(TOCropViewCroppingStyle)style image:(nonnull UIImage *)image NS_SWIFT_NAME(init(croppingStyle:image:));
382
+
383
+ /**
384
+ Commits the crop action as if user pressed done button in the bottom bar themself
385
+ */
386
+ - (void)commitCurrentCrop;
387
+
388
+ /**
389
+ Resets object of TOCropViewController class as if user pressed reset button in the bottom bar themself
390
+ */
391
+ - (void)resetCropViewLayout;
392
+
393
+ /**
394
+ Set the aspect ratio to be one of the available preset options. These presets have specific behaviour
395
+ such as swapping their dimensions depending on portrait or landscape sized images.
396
+
397
+ @param aspectRatioPreset The aspect ratio preset
398
+ @param animated Whether the transition to the aspect ratio is animated
399
+ */
400
+ - (void)setAspectRatioPreset:(CGSize)aspectRatioPreset animated:(BOOL)animated NS_SWIFT_NAME(setAspectRatioPreset(_:animated:));
401
+
402
+ /**
403
+ Play a custom animation of the target image zooming to its position in
404
+ the crop controller while the background fades in.
405
+
406
+ @param viewController The parent controller that this view controller would be presenting from.
407
+ @param fromView A view that's frame will be used as the origin for this animation. Optional if `fromFrame` has a value.
408
+ @param fromFrame In the screen's coordinate space, the frame from which the image should animate from. Optional if `fromView` has a value.
409
+ @param setup A block that is called just before the transition starts. Recommended for hiding any necessary image views.
410
+ @param completion A block that is called once the transition animation is completed.
411
+ */
412
+ - (void)presentAnimatedFromParentViewController:(nonnull UIViewController *)viewController
413
+ fromView:(nullable UIView *)fromView
414
+ fromFrame:(CGRect)fromFrame
415
+ setup:(nullable void (^)(void))setup
416
+ completion:(nullable void (^)(void))completion NS_SWIFT_NAME(presentAnimatedFrom(_:view:frame:setup:completion:));
417
+
418
+ /**
419
+ Play a custom animation of the target image zooming to its position in
420
+ the crop controller while the background fades in. Additionally, if you're
421
+ 'restoring' to a previous crop setup, this method lets you provide a previously
422
+ cropped copy of the image, and the previous crop settings to transition back to
423
+ where the user would have left off.
424
+
425
+ @param viewController The parent controller that this view controller would be presenting from.
426
+ @param image The previously cropped image that can be used in the transition animation.
427
+ @param fromView A view that's frame will be used as the origin for this animation. Optional if `fromFrame` has a value.
428
+ @param fromFrame In the screen's coordinate space, the frame from which the image should animate from.
429
+ @param angle The rotation angle in which the image was rotated when it was originally cropped.
430
+ @param toFrame In the image's coordinate space, the previous crop frame that created the previous crop
431
+ @param setup A block that is called just before the transition starts. Recommended for hiding any necessary image views.
432
+ @param completion A block that is called once the transition animation is completed.
433
+ */
434
+ - (void)presentAnimatedFromParentViewController:(nonnull UIViewController *)viewController
435
+ fromImage:(nullable UIImage *)image
436
+ fromView:(nullable UIView *)fromView
437
+ fromFrame:(CGRect)fromFrame
438
+ angle:(NSInteger)angle
439
+ toImageFrame:(CGRect)toFrame
440
+ setup:(nullable void (^)(void))setup
441
+ completion:(nullable void (^)(void))completion NS_SWIFT_NAME(presentAnimatedFrom(_:fromImage:fromView:fromFrame:angle:toFrame:setup:completion:));
442
+
443
+ /**
444
+ Play a custom animation of the supplied cropped image zooming out from
445
+ the cropped frame to the specified frame as the rest of the content fades out.
446
+ If any view configurations need to be done before the animation starts,
447
+
448
+ @param viewController The parent controller that this view controller would be presenting from.
449
+ @param toView A view who's frame will be used to establish the destination frame
450
+ @param frame The target frame that the image will animate to
451
+ @param setup A block that is called just before the transition starts. Recommended for hiding any necessary image views.
452
+ @param completion A block that is called once the transition animation is completed.
453
+ */
454
+ - (void)dismissAnimatedFromParentViewController:(nonnull UIViewController *)viewController
455
+ toView:(nullable UIView *)toView
456
+ toFrame:(CGRect)frame
457
+ setup:(nullable void (^)(void))setup
458
+ completion:(nullable void (^)(void))completion NS_SWIFT_NAME(dismissAnimatedFrom(_:toView:toFrame:setup:completion:));
459
+
460
+ /**
461
+ Play a custom animation of the supplied cropped image zooming out from
462
+ the cropped frame to the specified frame as the rest of the content fades out.
463
+ If any view configurations need to be done before the animation starts,
464
+
465
+ @param viewController The parent controller that this view controller would be presenting from.
466
+ @param image The resulting 'cropped' image. If supplied, will animate out of the crop box zone. If nil, the default image will entirely zoom out
467
+ @param toView A view who's frame will be used to establish the destination frame
468
+ @param frame The target frame that the image will animate to
469
+ @param setup A block that is called just before the transition starts. Recommended for hiding any necessary image views.
470
+ @param completion A block that is called once the transition animation is completed.
471
+ */
472
+ - (void)dismissAnimatedFromParentViewController:(nonnull UIViewController *)viewController
473
+ withCroppedImage:(nullable UIImage *)image
474
+ toView:(nullable UIView *)toView
475
+ toFrame:(CGRect)frame
476
+ setup:(nullable void (^)(void))setup
477
+ completion:(nullable void (^)(void))completion NS_SWIFT_NAME(dismissAnimatedFrom(_:croppedImage:toView:toFrame:setup:completion:));
478
+
479
+ @end