scoplan.camera 1.2.5
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.
- package/package.json +18 -0
- package/plugin.xml +119 -0
- package/src/android/AutoFitSurfaceView.java +66 -0
- package/src/android/CCropActivity.java +17 -0
- package/src/android/CDrawActivity.java +16 -0
- package/src/android/CTextActivity.java +17 -0
- package/src/android/CameraEventListener.java +8 -0
- package/src/android/CameraFragment.java +635 -0
- package/src/android/CameraSeekBarListener.java +105 -0
- package/src/android/CameraUtils.java +94 -0
- package/src/android/CustomI.java +37 -0
- package/src/android/FakeR.java +31 -0
- package/src/android/ImageCameraAvailableListener.java +65 -0
- package/src/android/OnImageCaptureListener.java +11 -0
- package/src/android/PhotoEditorActivity.java +128 -0
- package/src/android/PhotoEditorMenu.java +111 -0
- package/src/android/PhotoEditorMesureCustomActivity.java +218 -0
- package/src/android/PhotoEditorStore.java +50 -0
- package/src/android/ScoplanCamera.java +98 -0
- package/src/android/gradle/scoplanCamera.gradle +9 -0
- package/src/android/libs/ds-photo-editor-sdk-v9.aar +0 -0
- package/src/android/res/drawable/back_arrow.xml +5 -0
- package/src/android/res/drawable/camsicon.png +0 -0
- package/src/android/res/drawable/custom_spinner.xml +14 -0
- package/src/android/res/drawable/delete_img.png +0 -0
- package/src/android/res/drawable/draw_img.png +0 -0
- package/src/android/res/drawable/flash.png +0 -0
- package/src/android/res/drawable/flash_on.png +0 -0
- package/src/android/res/drawable/mesure.png +0 -0
- package/src/android/res/drawable/mesure_bar.xml +19 -0
- package/src/android/res/drawable/shape_back.xml +12 -0
- package/src/android/res/drawable/shape_cancel.xml +12 -0
- package/src/android/res/drawable/shape_rectangle.xml +4 -0
- package/src/android/res/layout/fragment_camera.xml +157 -0
- package/src/android/res/layout/fragment_photo_editor_menu.xml +122 -0
- package/src/ios/AVCamPhotoCaptureDelegate.h +20 -0
- package/src/ios/AVCamPhotoCaptureDelegate.m +244 -0
- package/src/ios/AVCamPreviewView.h +18 -0
- package/src/ios/AVCamPreviewView.m +33 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDK +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Assets.car +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/0dZ-3o-Xdu-view-Uan-aZ-nTR.nib/objects-11.0+.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/0dZ-3o-Xdu-view-Uan-aZ-nTR.nib/objects-13.0+.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/0dZ-3o-Xdu-view-Uan-aZ-nTR.nib/runtime.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/DSDrawViewController.nib/objects-11.0+.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/DSDrawViewController.nib/objects-13.0+.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/DSDrawViewController.nib/runtime.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/DSPhotoEditor.nib/objects-11.0+.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/DSPhotoEditor.nib/objects-13.0+.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/DSPhotoEditor.nib/runtime.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/Info.plist +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/Okc-Jl-tk5-view-siV-MN-Zgc.nib/objects-11.0+.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/Okc-Jl-tk5-view-siV-MN-Zgc.nib/objects-13.0+.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDK.storyboardc/Okc-Jl-tk5-view-siV-MN-Zgc.nib/runtime.nib +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Base.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/Info.plist +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ar.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ar.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/de.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/de.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/es.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/es.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/fr.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/fr.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/id.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/id.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/it.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/it.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ja.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ja.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ko.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ko.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ms.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ms.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/pt-PT.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/pt-PT.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ru.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/ru.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/th.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/th.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/tr.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/tr.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/vi.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/vi.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/zh-Hans.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/zh-Hans.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/zh-Hant.lproj/DSPhotoEditorSDK.strings +57 -0
- package/src/ios/DSPhotoEditorSDK.framework/DSPhotoEditorSDKResourceBundle.bundle/zh-Hant.lproj/DSPhotoEditorSDKLocalizable.strings +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/Headers/DSPhotoEditorSDK.h +18 -0
- package/src/ios/DSPhotoEditorSDK.framework/Headers/DSPhotoEditorViewController.h +112 -0
- package/src/ios/DSPhotoEditorSDK.framework/Info.plist +0 -0
- package/src/ios/DSPhotoEditorSDK.framework/License.md +70 -0
- package/src/ios/DSPhotoEditorSDK.framework/Modules/module.modulemap +6 -0
- package/src/ios/DSPhotoEditorSDK.framework/framework_version.txt +5 -0
- package/src/ios/DSPhotoEditorSDK.framework/strip-frameworks.sh +80 -0
- package/src/ios/Resources/Overlay.png +0 -0
- package/src/ios/Resources/Overlay@2x.png +0 -0
- package/src/ios/Resources/back_arrows.png +0 -0
- package/src/ios/Resources/ds_btn_calc.png +0 -0
- package/src/ios/Resources/ds_btn_crop.png +0 -0
- package/src/ios/Resources/ds_btn_del.png +0 -0
- package/src/ios/Resources/ds_btn_draw.png +0 -0
- package/src/ios/Resources/ds_btn_text.png +0 -0
- package/src/ios/Resources/measure_0.png +0 -0
- package/src/ios/Resources/measure_1.png +0 -0
- package/src/ios/Resources/measure_10.png +0 -0
- package/src/ios/Resources/measure_11.png +0 -0
- package/src/ios/Resources/measure_2.png +0 -0
- package/src/ios/Resources/measure_3.png +0 -0
- package/src/ios/Resources/measure_4.png +0 -0
- package/src/ios/Resources/measure_5.png +0 -0
- package/src/ios/Resources/measure_6.png +0 -0
- package/src/ios/Resources/measure_7.png +0 -0
- package/src/ios/Resources/measure_8.png +0 -0
- package/src/ios/Resources/measure_9.png +0 -0
- package/src/ios/Resources/no.png +0 -0
- package/src/ios/Resources/ok.png +0 -0
- package/src/ios/Resources/toward_arrows.png +0 -0
- package/src/ios/ScoplanCamera.h +18 -0
- package/src/ios/ScoplanCamera.m +179 -0
- package/src/ios/ScoplanCamera.storyboard +115 -0
- package/src/ios/UICustomPickerController.h +11 -0
- package/src/ios/UICustomPickerController.m +119 -0
- package/src/ios/UIImagePickerDelegate.h +11 -0
- package/src/ios/UIImagePickerDelegate.m +161 -0
- package/src/ios/UIScoplanCamera.h +20 -0
- package/src/ios/UIScoplanCamera.m +1098 -0
- package/src/ios/bottomPhotoEditor.xib +222 -0
- package/src/ios/camsicons.xcassets/Contents.json +6 -0
- package/src/ios/camsicons.xcassets/cameraicon.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/cameraicon.imageset/camsicon.png +0 -0
- package/src/ios/camsicons.xcassets/image000001.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image000001.imageset/image0000002.png +0 -0
- package/src/ios/camsicons.xcassets/image0000010.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000010.imageset/image0000010.png +0 -0
- package/src/ios/camsicons.xcassets/image0000011.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000011.imageset/image0000011.png +0 -0
- package/src/ios/camsicons.xcassets/image0000012.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000012.imageset/image0000012.png +0 -0
- package/src/ios/camsicons.xcassets/image0000013.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000013.imageset/image0000013.png +0 -0
- package/src/ios/camsicons.xcassets/image0000014.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000014.imageset/image0000014.png +0 -0
- package/src/ios/camsicons.xcassets/image0000015.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000015.imageset/image0000015.png +0 -0
- package/src/ios/camsicons.xcassets/image0000016.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000016.imageset/image0000016.png +0 -0
- package/src/ios/camsicons.xcassets/image0000017.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000017.imageset/image0000017.png +0 -0
- package/src/ios/camsicons.xcassets/image0000018.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000018.imageset/image0000018.png +0 -0
- package/src/ios/camsicons.xcassets/image0000019.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image0000019.imageset/image0000019.png +0 -0
- package/src/ios/camsicons.xcassets/image000002.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image000002.imageset/image0000001.png +0 -0
- package/src/ios/camsicons.xcassets/image000003.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image000003.imageset/image0000003.png +0 -0
- package/src/ios/camsicons.xcassets/image000004.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image000004.imageset/image0000004.png +0 -0
- package/src/ios/camsicons.xcassets/image000005.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image000005.imageset/image0000005.png +0 -0
- package/src/ios/camsicons.xcassets/image000006.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image000006.imageset/image0000006.png +0 -0
- package/src/ios/camsicons.xcassets/image000007.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image000007.imageset/image0000007.png +0 -0
- package/src/ios/camsicons.xcassets/image000008.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image000008.imageset/image0000008.png +0 -0
- package/src/ios/camsicons.xcassets/image000009.imageset/Contents.json +21 -0
- package/src/ios/camsicons.xcassets/image000009.imageset/image0000009.png +0 -0
- package/src/ios/multicam.xib +113 -0
- package/www/ScoplanCamera.js +5 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
#import "ScoplanCamera.h"
|
|
2
|
+
#import "UIScoplanCamera.h"
|
|
3
|
+
#import "UIImagePickerDelegate.h"
|
|
4
|
+
#import "UICustomPickerController.h"
|
|
5
|
+
|
|
6
|
+
/********* ScoplanCamera.m Cordova Plugin Implementation *******/
|
|
7
|
+
@interface ScoplanCamera()
|
|
8
|
+
@property (nonatomic) UIImagePickerDelegate * pickerdelegate;
|
|
9
|
+
@property (nonatomic) UIView * overLayView;
|
|
10
|
+
@property (nonatomic) UICustomPickerController *cameraUI;
|
|
11
|
+
@property int photoLimit;
|
|
12
|
+
@property int currentCount;
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
@implementation ScoplanCamera
|
|
16
|
+
|
|
17
|
+
- (void)addDrawSel:(SEL)selector{
|
|
18
|
+
UILabel* label = [self.cameraUI.cameraOverlayView viewWithTag:13];
|
|
19
|
+
[label setUserInteractionEnabled:YES];
|
|
20
|
+
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self.cameraUI action:selector];
|
|
21
|
+
tap.numberOfTapsRequired = 1;
|
|
22
|
+
[label addGestureRecognizer:tap];
|
|
23
|
+
UIButton* btn = [self.cameraUI.cameraOverlayView viewWithTag:14];
|
|
24
|
+
[btn addTarget:self.cameraUI action:selector forControlEvents:UIControlEventTouchUpInside];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
-(void)cancelConfirm:(id)sender{
|
|
28
|
+
NSLog(@"cancelOrok");
|
|
29
|
+
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Attention" message:@"Voulez-vous sortir sans enregistrer la photo" preferredStyle:UIAlertControllerStyleAlert];
|
|
30
|
+
UIAlertAction* nonAction = [UIAlertAction actionWithTitle:@"Non" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
|
|
31
|
+
[alert dismissViewControllerAnimated:YES completion:nil];
|
|
32
|
+
}];
|
|
33
|
+
[alert addAction:nonAction];
|
|
34
|
+
UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"Oui" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
|
|
35
|
+
[alert dismissViewControllerAnimated:YES completion:nil];
|
|
36
|
+
[mpictures removeAllObjects];
|
|
37
|
+
[self dismisCam];
|
|
38
|
+
}];
|
|
39
|
+
[alert addAction:okAction];
|
|
40
|
+
[self.cameraUI presentViewController:alert animated:YES completion:nil];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
-(void)cancelClicked:(id)sender{
|
|
44
|
+
NSLog(@"cancelOrok");
|
|
45
|
+
[self dismisCam];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (void) ShowAlert:(NSString *)Message {
|
|
49
|
+
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Attention" message:Message preferredStyle:UIAlertControllerStyleAlert];
|
|
50
|
+
UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
|
|
51
|
+
[alert dismissViewControllerAnimated:YES completion:nil];
|
|
52
|
+
[self dismisCam];
|
|
53
|
+
}];
|
|
54
|
+
[alert addAction:okAction];
|
|
55
|
+
[self.cameraUI presentViewController:alert animated:YES completion:nil];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
-(void)takenClicked:(id)sender{
|
|
59
|
+
if(mpictures.count + self.currentCount == self.photoLimit) {
|
|
60
|
+
[self ShowAlert:[NSString stringWithFormat:@"La prise de photos est limitée à %d par envoi", self.photoLimit]];
|
|
61
|
+
} else {
|
|
62
|
+
[self shoot];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
-(void)setPreview:(UIImage*)img{
|
|
67
|
+
UIImageView * imagePreview = ((UIImageView *)[self.cameraUI.cameraOverlayView viewWithTag:3]);
|
|
68
|
+
[imagePreview setImage:img];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
-(void)removeLastPreview{
|
|
72
|
+
UIImageView * imagePreview = ((UIImageView *)[self.cameraUI.cameraOverlayView viewWithTag:3]);
|
|
73
|
+
if([mpictures count] > 1){
|
|
74
|
+
[mpictures removeLastObject];
|
|
75
|
+
UIImage *img = [UIImage imageWithContentsOfFile:[mpictures lastObject]];
|
|
76
|
+
[imagePreview setImage:img];
|
|
77
|
+
}else{
|
|
78
|
+
[mpictures removeAllObjects];
|
|
79
|
+
[imagePreview setImage:nil];
|
|
80
|
+
UIView* view = [self.cameraUI.cameraOverlayView viewWithTag:11];
|
|
81
|
+
[view setHidden:YES];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
-(void)resetAll{
|
|
86
|
+
[mpictures removeAllObjects];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
- (void)insertPicture:(NSString*)url{
|
|
90
|
+
UIView* view = [self.cameraUI.cameraOverlayView viewWithTag:11];
|
|
91
|
+
[view setHidden:NO];
|
|
92
|
+
[mpictures addObject:url];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
- (void)flushPicture:(NSString*)url{
|
|
96
|
+
NSUInteger count = [mpictures count];
|
|
97
|
+
mpictures[count - 1] = url;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
- (void)dismisCam{
|
|
101
|
+
[self.cameraUI dismissViewControllerAnimated:TRUE completion:nil];
|
|
102
|
+
CDVPluginResult* pluginResult = [CDVPluginResult
|
|
103
|
+
resultWithStatus:CDVCommandStatus_OK
|
|
104
|
+
messageAsArray:mpictures];
|
|
105
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:mcallback.callbackId];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
- (void) takePictures:(CDVInvokedUrlCommand*)command {
|
|
109
|
+
NSDictionary *options = [command.arguments objectAtIndex:0];
|
|
110
|
+
self.photoLimit = [options[@"photoLimit"] intValue];
|
|
111
|
+
NSDictionary *options2 = [command.arguments objectAtIndex:1];
|
|
112
|
+
self.currentCount = [options2[@"currentCount"] intValue];
|
|
113
|
+
// NSLog([NSString stringWithFormat:@"photoLimit : %d", self.photoLimit]);
|
|
114
|
+
// NSLog([NSString stringWithFormat:@"currentCount : %d", self.currentCount]);
|
|
115
|
+
[[UIDevice currentDevice] setValue:
|
|
116
|
+
[NSNumber numberWithInteger: UIInterfaceOrientationPortrait]
|
|
117
|
+
forKey:@"orientation"];
|
|
118
|
+
mcallback = command;
|
|
119
|
+
mpictures = [[NSMutableArray alloc]init];
|
|
120
|
+
[self.commandDelegate runInBackground: ^{
|
|
121
|
+
CDVPluginResult* pluginResult = [CDVPluginResult
|
|
122
|
+
resultWithStatus:CDVCommandStatus_NO_RESULT
|
|
123
|
+
messageAsArray:self->mpictures];
|
|
124
|
+
[pluginResult setKeepCallback:[[NSNumber alloc] initWithBool:TRUE]];
|
|
125
|
+
self.pickerdelegate = [[UIImagePickerDelegate alloc]init];
|
|
126
|
+
[self.pickerdelegate setCam:self];
|
|
127
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
128
|
+
dispatch_async( dispatch_get_main_queue(), ^{
|
|
129
|
+
NSBundle *nsbundle = [NSBundle mainBundle];
|
|
130
|
+
NSArray * nib = [nsbundle loadNibNamed:@"multicam" owner:self.viewController options:nil];
|
|
131
|
+
self.overLayView = [nib objectAtIndex:0];
|
|
132
|
+
UIButton *takeBtn = (UIButton *)[self.overLayView viewWithTag:1];
|
|
133
|
+
[takeBtn addTarget: self action: @selector(takenClicked:) forControlEvents: UIControlEventTouchUpInside];
|
|
134
|
+
UIButton *cancelBtn = (UIButton *)[self.overLayView viewWithTag:2];
|
|
135
|
+
UIButton *cancelBtn2 = (UIButton *)[self.overLayView viewWithTag:12];
|
|
136
|
+
dispatch_async( dispatch_get_main_queue(), ^{
|
|
137
|
+
[cancelBtn setTitle:@"Annuler" forState:UIControlStateNormal];
|
|
138
|
+
});
|
|
139
|
+
[cancelBtn addTarget: self action: @selector(cancelClicked:) forControlEvents: UIControlEventTouchUpInside];
|
|
140
|
+
[cancelBtn2 addTarget: self action: @selector(cancelConfirm:) forControlEvents: UIControlEventTouchUpInside];
|
|
141
|
+
UIImageView * imagePreview = ((UIImageView *)[self.overLayView viewWithTag:3]);
|
|
142
|
+
imagePreview.image = nil;
|
|
143
|
+
[self.webView addSubview:self.overLayView];
|
|
144
|
+
[self startCameraControllerFromViewController:self.viewController usingDelegate:self->_pickerdelegate];
|
|
145
|
+
} );
|
|
146
|
+
}];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
- (void) shoot{
|
|
150
|
+
[self.cameraUI takePicture];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
- (BOOL) startCameraControllerFromViewController: (UIViewController*) controller
|
|
154
|
+
usingDelegate: (id <UIImagePickerControllerDelegate,
|
|
155
|
+
UINavigationControllerDelegate>) delegate {
|
|
156
|
+
|
|
157
|
+
if (([UIImagePickerController isSourceTypeAvailable:
|
|
158
|
+
UIImagePickerControllerSourceTypeCamera] == NO)
|
|
159
|
+
|| (delegate == nil)
|
|
160
|
+
|| (controller == nil))
|
|
161
|
+
return NO;
|
|
162
|
+
|
|
163
|
+
self.cameraUI = [[UICustomPickerController alloc] init];
|
|
164
|
+
self.cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
|
|
165
|
+
self.cameraUI.showsCameraControls = NO;
|
|
166
|
+
self.cameraUI.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
|
|
167
|
+
self.cameraUI.allowsEditing = NO;
|
|
168
|
+
self.cameraUI.delegate = delegate;
|
|
169
|
+
self.overLayView.frame = self.cameraUI.cameraOverlayView.frame;
|
|
170
|
+
self.cameraUI.cameraOverlayView = self.overLayView;
|
|
171
|
+
float camHeight = ([[UIScreen mainScreen] bounds].size.height/2)*15/100;
|
|
172
|
+
UIImageView * imagePreview = ((UIImageView *)[self.overLayView viewWithTag:3]);
|
|
173
|
+
[self.cameraUI initData:imagePreview mCamera:self];
|
|
174
|
+
self.cameraUI.cameraViewTransform = CGAffineTransformTranslate(self.cameraUI.cameraViewTransform, 0, camHeight);
|
|
175
|
+
[controller presentViewController:self.cameraUI animated:YES completion:nil];
|
|
176
|
+
return YES;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
|
3
|
+
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
|
4
|
+
<dependencies>
|
|
5
|
+
<deployment identifier="iOS"/>
|
|
6
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
|
|
7
|
+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
8
|
+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
9
|
+
</dependencies>
|
|
10
|
+
<scenes>
|
|
11
|
+
<!--ScoplanCamera-->
|
|
12
|
+
<scene sceneID="WnN-d9-cPV">
|
|
13
|
+
<objects>
|
|
14
|
+
<viewController storyboardIdentifier="ScoplanCamera" title="ScoplanCamera" useStoryboardIdentifierAsRestorationIdentifier="YES" id="AA8-Jf-iAm" customClass="UIScoplanCamera" sceneMemberID="viewController">
|
|
15
|
+
<view key="view" contentMode="scaleToFill" id="8ze-qw-dRA">
|
|
16
|
+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
17
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
18
|
+
<subviews>
|
|
19
|
+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Dph-cD-OZJ" userLabel="Preview" customClass="AVCamPreviewView">
|
|
20
|
+
<rect key="frame" x="0.0" y="0.0" width="414" height="862"/>
|
|
21
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
|
22
|
+
<gestureRecognizers/>
|
|
23
|
+
<connections>
|
|
24
|
+
<outletCollection property="gestureRecognizers" destination="Wqi-ea-KMR" appends="YES" id="oAd-i0-IMA"/>
|
|
25
|
+
</connections>
|
|
26
|
+
</view>
|
|
27
|
+
<view alpha="0.25" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jGC-3L-9Um" userLabel="black">
|
|
28
|
+
<rect key="frame" x="0.0" y="735" width="414" height="127"/>
|
|
29
|
+
<color key="backgroundColor" systemColor="viewFlipsideBackgroundColor"/>
|
|
30
|
+
<constraints>
|
|
31
|
+
<constraint firstAttribute="width" secondItem="jGC-3L-9Um" secondAttribute="height" multiplier="160:49" id="YuY-vB-8QI"/>
|
|
32
|
+
</constraints>
|
|
33
|
+
</view>
|
|
34
|
+
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lmm-Ty-vl6" userLabel="imageview">
|
|
35
|
+
<rect key="frame" x="20" y="787" width="50" height="50"/>
|
|
36
|
+
<constraints>
|
|
37
|
+
<constraint firstAttribute="width" constant="50" id="GxG-7V-98h"/>
|
|
38
|
+
<constraint firstAttribute="height" constant="50" id="j8A-7b-Pdm"/>
|
|
39
|
+
</constraints>
|
|
40
|
+
</imageView>
|
|
41
|
+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nqA-FF-aMJ">
|
|
42
|
+
<rect key="frame" x="275.5" y="797" width="53" height="30"/>
|
|
43
|
+
<constraints>
|
|
44
|
+
<constraint firstAttribute="height" constant="30" id="1gH-LF-9jk"/>
|
|
45
|
+
</constraints>
|
|
46
|
+
<state key="normal" title="Annuler">
|
|
47
|
+
<color key="titleColor" red="1" green="1" blue="0.10045030381944445" alpha="1" colorSpace="calibratedRGB"/>
|
|
48
|
+
</state>
|
|
49
|
+
<connections>
|
|
50
|
+
<action selector="backtowebview:" destination="AA8-Jf-iAm" eventType="touchUpInside" id="8HQ-lG-VyA"/>
|
|
51
|
+
</connections>
|
|
52
|
+
</button>
|
|
53
|
+
<button opaque="NO" contentMode="center" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cRf-Sp-1y2">
|
|
54
|
+
<rect key="frame" x="182" y="787" width="50" height="50"/>
|
|
55
|
+
<constraints>
|
|
56
|
+
<constraint firstAttribute="height" constant="50" id="3uF-tj-9po"/>
|
|
57
|
+
<constraint firstAttribute="width" secondItem="cRf-Sp-1y2" secondAttribute="height" multiplier="1:1" id="jhA-cY-Fs5"/>
|
|
58
|
+
<constraint firstAttribute="width" constant="50" id="uOm-7L-ufR"/>
|
|
59
|
+
</constraints>
|
|
60
|
+
<state key="normal" image="cameraicon"/>
|
|
61
|
+
<connections>
|
|
62
|
+
<action selector="capturePhoto:" destination="AA8-Jf-iAm" eventType="touchUpInside" id="SYO-4q-i9Z"/>
|
|
63
|
+
</connections>
|
|
64
|
+
</button>
|
|
65
|
+
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="YrK-DJ-ony">
|
|
66
|
+
<rect key="frame" x="182" y="787" width="50" height="50"/>
|
|
67
|
+
<constraints>
|
|
68
|
+
<constraint firstAttribute="height" constant="50" id="1ap-FV-bAg"/>
|
|
69
|
+
<constraint firstAttribute="width" constant="50" id="8dJ-8K-RdS"/>
|
|
70
|
+
</constraints>
|
|
71
|
+
</imageView>
|
|
72
|
+
</subviews>
|
|
73
|
+
<viewLayoutGuide key="safeArea" id="jij-t7-zCY"/>
|
|
74
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
|
75
|
+
<constraints>
|
|
76
|
+
<constraint firstItem="jij-t7-zCY" firstAttribute="bottom" secondItem="YrK-DJ-ony" secondAttribute="bottom" constant="25" id="0MC-Rx-Lgu"/>
|
|
77
|
+
<constraint firstItem="jGC-3L-9Um" firstAttribute="leading" secondItem="jij-t7-zCY" secondAttribute="leading" id="3iI-5o-Y21"/>
|
|
78
|
+
<constraint firstItem="YrK-DJ-ony" firstAttribute="centerX" secondItem="8ze-qw-dRA" secondAttribute="centerX" id="56H-C7-K1g"/>
|
|
79
|
+
<constraint firstItem="Dph-cD-OZJ" firstAttribute="bottom" secondItem="jij-t7-zCY" secondAttribute="bottom" id="Bla-Mv-ywP"/>
|
|
80
|
+
<constraint firstItem="cRf-Sp-1y2" firstAttribute="centerX" secondItem="8ze-qw-dRA" secondAttribute="centerX" id="IwK-Lt-F2A"/>
|
|
81
|
+
<constraint firstItem="Dph-cD-OZJ" firstAttribute="leading" secondItem="8ze-qw-dRA" secondAttribute="leading" id="ZPE-Xb-bhT"/>
|
|
82
|
+
<constraint firstItem="jij-t7-zCY" firstAttribute="bottom" secondItem="cRf-Sp-1y2" secondAttribute="bottom" constant="25" id="d7J-t5-TqX"/>
|
|
83
|
+
<constraint firstAttribute="trailing" secondItem="Dph-cD-OZJ" secondAttribute="trailing" id="owy-xt-NSQ"/>
|
|
84
|
+
<constraint firstItem="Dph-cD-OZJ" firstAttribute="top" secondItem="8ze-qw-dRA" secondAttribute="top" id="pfp-tG-hKN"/>
|
|
85
|
+
<constraint firstItem="jGC-3L-9Um" firstAttribute="trailing" secondItem="jij-t7-zCY" secondAttribute="trailing" id="qXe-P5-MY6"/>
|
|
86
|
+
<constraint firstItem="jij-t7-zCY" firstAttribute="bottom" secondItem="nqA-FF-aMJ" secondAttribute="bottom" constant="35" id="rjG-z6-8aH"/>
|
|
87
|
+
<constraint firstItem="jGC-3L-9Um" firstAttribute="bottom" secondItem="jij-t7-zCY" secondAttribute="bottom" id="rq9-se-5dj"/>
|
|
88
|
+
<constraint firstItem="nqA-FF-aMJ" firstAttribute="centerX" secondItem="8ze-qw-dRA" secondAttribute="centerX" constant="95" id="sCH-2R-4Wi"/>
|
|
89
|
+
<constraint firstItem="jij-t7-zCY" firstAttribute="bottom" secondItem="lmm-Ty-vl6" secondAttribute="bottom" constant="25" id="t0l-GX-7v2"/>
|
|
90
|
+
<constraint firstItem="lmm-Ty-vl6" firstAttribute="leading" secondItem="jij-t7-zCY" secondAttribute="leading" constant="20" id="zuS-KY-tMG"/>
|
|
91
|
+
</constraints>
|
|
92
|
+
</view>
|
|
93
|
+
<connections>
|
|
94
|
+
<outlet property="blackbottom" destination="jGC-3L-9Um" id="meg-H7-5oV"/>
|
|
95
|
+
<outlet property="imageview" destination="lmm-Ty-vl6" id="4tT-eQ-Drt"/>
|
|
96
|
+
<outlet property="okbutton" destination="nqA-FF-aMJ" id="BGp-mM-zEZ"/>
|
|
97
|
+
<outlet property="photoButton" destination="cRf-Sp-1y2" id="E8a-Tn-i4I"/>
|
|
98
|
+
<outlet property="previewView" destination="Dph-cD-OZJ" id="vRY-ZA-0Lb"/>
|
|
99
|
+
<outlet property="progress" destination="YrK-DJ-ony" id="dbU-hq-8qa"/>
|
|
100
|
+
<outlet property="rootView" destination="8ze-qw-dRA" id="82p-tj-JCg"/>
|
|
101
|
+
</connections>
|
|
102
|
+
</viewController>
|
|
103
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="Mwu-hs-3d6" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
104
|
+
<tapGestureRecognizer id="Wqi-ea-KMR"/>
|
|
105
|
+
</objects>
|
|
106
|
+
<point key="canvasLocation" x="-245.625" y="-183.80281690140845"/>
|
|
107
|
+
</scene>
|
|
108
|
+
</scenes>
|
|
109
|
+
<resources>
|
|
110
|
+
<image name="cameraicon" width="214" height="213"/>
|
|
111
|
+
<systemColor name="viewFlipsideBackgroundColor">
|
|
112
|
+
<color red="0.1215686274509804" green="0.12941176470588239" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
|
113
|
+
</systemColor>
|
|
114
|
+
</resources>
|
|
115
|
+
</document>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#import <DSPhotoEditorSDK/DSPhotoEditorSDK.h>
|
|
2
|
+
#import <DSPhotoEditorSDK/DSPhotoEditorViewController.h>
|
|
3
|
+
#import "ScoplanCamera.h"
|
|
4
|
+
|
|
5
|
+
@interface UICustomPickerController : UIImagePickerController<DSPhotoEditorViewControllerDelegate>{
|
|
6
|
+
UIImageView* imageSouche;
|
|
7
|
+
DSPhotoEditorViewController* dsController;
|
|
8
|
+
ScoplanCamera* mCamera;
|
|
9
|
+
}
|
|
10
|
+
-(void)initData:(UIImageView*)souche mCamera:(ScoplanCamera*)mcm;
|
|
11
|
+
@end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UICustomPickerController.m
|
|
3
|
+
// My happy client
|
|
4
|
+
//
|
|
5
|
+
// Created by Adriela on 30/01/2020.
|
|
6
|
+
//
|
|
7
|
+
#import "UICustomPickerController.h"
|
|
8
|
+
|
|
9
|
+
@implementation UICustomPickerController
|
|
10
|
+
-(void)initData:(UIImageView*)souche mCamera:(ScoplanCamera*)mcm{
|
|
11
|
+
imageSouche = souche;
|
|
12
|
+
mCamera = mcm;
|
|
13
|
+
UITapGestureRecognizer *tapGesture1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(launchDSPhotoEditorSDK:)];
|
|
14
|
+
tapGesture1.numberOfTapsRequired = 1;
|
|
15
|
+
imageSouche.userInteractionEnabled = YES;
|
|
16
|
+
[tapGesture1 setDelegate:self];
|
|
17
|
+
[imageSouche addGestureRecognizer:tapGesture1];
|
|
18
|
+
[mCamera addDrawSel:@selector(launchDSPhotoEditorSDK:)];
|
|
19
|
+
}
|
|
20
|
+
/* DSPphoto */
|
|
21
|
+
- (void) launchDSPhotoEditorSDK: (id) sender {
|
|
22
|
+
NSArray *toolsToHide = @[@(TOOL_ORIENTATION), @(TOOL_FRAME),@(TOOL_FILTER),@(TOOL_ROUND),@(TOOL_EXPOSURE), @(TOOL_CIRCLE),@(TOOL_CONTRAST),@(TOOL_VIGNETTE),@(TOOL_SATURATION),@(TOOL_SHARPNESS),@(TOOL_WARMTH),@(TOOL_PIXELATE),@(TOOL_CROP),@(TOOL_DRAW),@(TOOL_TEXT),@(TOOL_STICKER)];
|
|
23
|
+
dsController = [[DSPhotoEditorViewController alloc] initWithImage:imageSouche.image toolsToHide:toolsToHide];
|
|
24
|
+
NSArray *colorImages =@[@"measure_0",@"measure_1",@"measure_2",@"measure_3",@"measure_4",@"measure_5",@"measure_6",@"measure_7",@"measure_8",@"measure_9",@"measure_10",@"measure_11"];
|
|
25
|
+
[dsController setCustomStickers:colorImages inBundle:[NSBundle mainBundle]];
|
|
26
|
+
dsController.delegate = self;
|
|
27
|
+
dsController.modalPresentationStyle = UIModalPresentationFullScreen;
|
|
28
|
+
[self presentViewController:dsController animated:YES completion:^(){
|
|
29
|
+
|
|
30
|
+
}];
|
|
31
|
+
UIView* parentBottom = [self->dsController dsBottomScrollView];
|
|
32
|
+
if([[self->dsController dsBottomContentView].superview viewWithTag:46] == nil){
|
|
33
|
+
dispatch_async( dispatch_get_main_queue(), ^{
|
|
34
|
+
UIView* btnView = [[[NSBundle mainBundle] loadNibNamed:@"bottomPhotoEditor" owner:self->dsController options:nil] objectAtIndex:0];
|
|
35
|
+
[self imageAddTarget:[btnView viewWithTag:10] sel:@selector(openCrop)];
|
|
36
|
+
[self imageAddTarget:[btnView viewWithTag:20] sel:@selector(openDraw)];
|
|
37
|
+
[self imageAddTarget:[btnView viewWithTag:30] sel:@selector(openText)];
|
|
38
|
+
[self imageAddTarget:[btnView viewWithTag:40] sel:@selector(deleteImage)];
|
|
39
|
+
[self imageAddTarget:[btnView viewWithTag:52] sel:@selector(openSticker)];
|
|
40
|
+
[self->dsController.dsBottomScrollView setHidden:YES];
|
|
41
|
+
btnView.layer.frame = CGRectMake(0, [self->dsController dsPhotoEditorImageView].layer.frame.size.height + [self->dsController dsPhotoEditorImageView].layer.frame.origin.y + ([UIScreen mainScreen].bounds.size.height - self->dsController.dsBottomContentView.layer.frame.size.height - ([self->dsController dsPhotoEditorImageView].layer.frame.size.height + [self->dsController dsPhotoEditorImageView].layer.frame.origin.y)), [UIScreen mainScreen].bounds.size.width, self->dsController.dsBottomContentView.layer.frame.size.height);
|
|
42
|
+
[parentBottom.superview insertSubview:btnView belowSubview:[self->dsController dsBottomScrollView]];
|
|
43
|
+
UIButton* cancel = [self->dsController.dsTopStackView subviews][0];
|
|
44
|
+
[cancel addTarget:self action:@selector(switchBtn) forControlEvents:UIControlEventTouchUpInside];
|
|
45
|
+
UIButton* ok = [self->dsController.dsTopStackView subviews][2];
|
|
46
|
+
[ok addTarget:self action:@selector(switchBtn) forControlEvents:UIControlEventTouchUpInside];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
-(void)imageAddTarget:(UIView*) img sel:(SEL)selector{
|
|
52
|
+
UITapGestureRecognizer *tapG = [[UITapGestureRecognizer alloc] initWithTarget:self action:selector];
|
|
53
|
+
tapG.numberOfTapsRequired = 1;
|
|
54
|
+
img.userInteractionEnabled = YES;
|
|
55
|
+
[tapG setDelegate:self];
|
|
56
|
+
[img addGestureRecognizer:tapG];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
-(void)openSticker{
|
|
60
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
61
|
+
[self->dsController.dsBottomScrollView setHidden:NO];
|
|
62
|
+
});
|
|
63
|
+
[dsController.dsTopTitleView setText:@"Mesure"];
|
|
64
|
+
[dsController dsPhotoEditorSticker:dsController];
|
|
65
|
+
[dsController.dsTopTitleView setText:@"Mesure"];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
-(void)openCrop{
|
|
69
|
+
[dsController dsPhotoEditorCrop:dsController];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
-(void)openDraw{
|
|
73
|
+
[dsController dsPhotoEditorDraw:dsController];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
-(void)openText{
|
|
77
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
78
|
+
[self->dsController.dsBottomScrollView setHidden:NO];
|
|
79
|
+
});
|
|
80
|
+
[dsController dsPhotoEditorStickerText:dsController];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
-(void)switchBtn{
|
|
84
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
85
|
+
[self->dsController.dsBottomScrollView setHidden:YES];
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
-(void)deleteImage{
|
|
90
|
+
[dsController dsPhotoEditorCancel:nil];
|
|
91
|
+
[mCamera removeLastPreview];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
- (void)dsPhotoEditor:(DSPhotoEditorViewController *)editor finishedWithImage:(UIImage *)image {
|
|
95
|
+
[self dismissViewControllerAnimated:YES completion:^(){
|
|
96
|
+
NSDate *currentDate = [NSDate date];
|
|
97
|
+
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
|
98
|
+
[dateFormatter setDateFormat:@"dd_MM_YY_HH_mm_ss_SSS"];
|
|
99
|
+
NSString *filename = [dateFormatter stringFromDate:currentDate];
|
|
100
|
+
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
101
|
+
NSString *docsPath = [paths objectAtIndex:0];
|
|
102
|
+
NSString* thumbnailPath = [NSString stringWithFormat:@"%@/%@_mthumb.jpg", docsPath, filename];
|
|
103
|
+
NSError* err = nil;
|
|
104
|
+
if ([UIImageJPEGRepresentation(image, 0.8) writeToFile:thumbnailPath options:NSAtomicWrite error:&err]){
|
|
105
|
+
NSLog(@"%@",thumbnailPath);
|
|
106
|
+
}else {
|
|
107
|
+
if (err) {
|
|
108
|
+
NSLog(@"Error saving image: %@", [err localizedDescription]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
[self->mCamera flushPicture:thumbnailPath];
|
|
112
|
+
[self->mCamera setPreview:image];
|
|
113
|
+
}];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
- (void)dsPhotoEditorCanceled:(DSPhotoEditorViewController *)editor {
|
|
117
|
+
[self dismissViewControllerAnimated:YES completion:nil];
|
|
118
|
+
}
|
|
119
|
+
@end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIImagePickerDelegate.h
|
|
3
|
+
// My happy client
|
|
4
|
+
//
|
|
5
|
+
// Created by Adriela on 08/10/2018.
|
|
6
|
+
//
|
|
7
|
+
@class ScoplanCamera;
|
|
8
|
+
@interface UIImagePickerDelegate : NSObject<UIImagePickerControllerDelegate,UINavigationControllerDelegate>{
|
|
9
|
+
}
|
|
10
|
+
- (void) setCam:(ScoplanCamera *) cam;
|
|
11
|
+
@end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIImagePickerDelegate.m
|
|
3
|
+
// My happy client
|
|
4
|
+
//
|
|
5
|
+
// Created by Adriela on 08/10/2018.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "UIImagePickerDelegate.h"
|
|
10
|
+
#import "ScoplanCamera.h"
|
|
11
|
+
#import <DSPhotoEditorSDK/DSPhotoEditorSDK.h>
|
|
12
|
+
|
|
13
|
+
@interface UIImagePickerDelegate()
|
|
14
|
+
@property (nonatomic) ScoplanCamera *mCamera;
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
@implementation UIImagePickerDelegate
|
|
18
|
+
- (void) setCam:(ScoplanCamera *) cam{
|
|
19
|
+
self.mCamera = cam;
|
|
20
|
+
}
|
|
21
|
+
- (void) imagePickerControllerDidCancel: (UIImagePickerController *) picker {
|
|
22
|
+
[picker dismissViewControllerAnimated: YES completion:nil];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
- (void) imagePickerController: (UIImagePickerController *) picker
|
|
26
|
+
didFinishPickingMediaWithInfo: (NSDictionary *) info {
|
|
27
|
+
UIImage *originalImage;
|
|
28
|
+
originalImage = (UIImage *) [info objectForKey:
|
|
29
|
+
UIImagePickerControllerOriginalImage];
|
|
30
|
+
NSDate *currentDate = [NSDate date];
|
|
31
|
+
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
|
32
|
+
[dateFormatter setDateFormat:@"dd_MM_YY_HH_mm_ss_SSS"];
|
|
33
|
+
NSString *filename = [dateFormatter stringFromDate:currentDate];
|
|
34
|
+
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
35
|
+
NSString *docsPath = [paths objectAtIndex:0];
|
|
36
|
+
//NSString* docsPath = [NSTemporaryDirectory() stringByStandardizingPath];
|
|
37
|
+
NSString* thumbnailPath = [NSString stringWithFormat:@"%@/%@_mthumb.jpg", docsPath, filename];
|
|
38
|
+
NSError* err = nil;
|
|
39
|
+
originalImage = [self scaleAndRotateImage:originalImage];
|
|
40
|
+
if ([UIImageJPEGRepresentation(originalImage, 0.8) writeToFile:thumbnailPath options:NSAtomicWrite error:&err]){
|
|
41
|
+
NSLog(@"%@",thumbnailPath);
|
|
42
|
+
}else {
|
|
43
|
+
if (err) {
|
|
44
|
+
NSLog(@"Error saving image: %@", [err localizedDescription]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
[self.mCamera insertPicture:thumbnailPath];
|
|
48
|
+
[(UIButton *)[picker.cameraOverlayView viewWithTag:2] setTitle:@"OK" forState:UIControlStateNormal];
|
|
49
|
+
[(UIImageView *)[picker.cameraOverlayView viewWithTag:3] setImage:originalImage];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
-(UIImage *) scaleAndRotateImage:(UIImage *)image
|
|
53
|
+
{
|
|
54
|
+
int kMaxResolution = 2208; // Or whatever
|
|
55
|
+
|
|
56
|
+
CGImageRef imgRef = image.CGImage;
|
|
57
|
+
|
|
58
|
+
CGFloat width = CGImageGetWidth(imgRef);
|
|
59
|
+
CGFloat height = CGImageGetHeight(imgRef);
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
CGAffineTransform transform = CGAffineTransformIdentity;
|
|
63
|
+
CGRect bounds = CGRectMake(0, 0, width, height);
|
|
64
|
+
if (width > kMaxResolution || height > kMaxResolution) {
|
|
65
|
+
CGFloat ratio = width/height;
|
|
66
|
+
if (ratio > 1) {
|
|
67
|
+
bounds.size.width = kMaxResolution;
|
|
68
|
+
bounds.size.height = bounds.size.width / ratio;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
bounds.size.height = kMaxResolution;
|
|
72
|
+
bounds.size.width = bounds.size.height * ratio;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
CGFloat scaleRatio = bounds.size.width / width;
|
|
77
|
+
CGSize imageSize = CGSizeMake(CGImageGetWidth(imgRef), CGImageGetHeight(imgRef));
|
|
78
|
+
CGFloat boundHeight;
|
|
79
|
+
UIImageOrientation orient = image.imageOrientation;
|
|
80
|
+
switch(orient) {
|
|
81
|
+
|
|
82
|
+
case UIImageOrientationUp: //EXIF = 1
|
|
83
|
+
transform = CGAffineTransformIdentity;
|
|
84
|
+
break;
|
|
85
|
+
|
|
86
|
+
case UIImageOrientationUpMirrored: //EXIF = 2
|
|
87
|
+
transform = CGAffineTransformMakeTranslation(imageSize.width, 0.0);
|
|
88
|
+
transform = CGAffineTransformScale(transform, -1.0, 1.0);
|
|
89
|
+
break;
|
|
90
|
+
|
|
91
|
+
case UIImageOrientationDown: //EXIF = 3
|
|
92
|
+
transform = CGAffineTransformMakeTranslation(imageSize.width, imageSize.height);
|
|
93
|
+
transform = CGAffineTransformRotate(transform, M_PI);
|
|
94
|
+
break;
|
|
95
|
+
|
|
96
|
+
case UIImageOrientationDownMirrored: //EXIF = 4
|
|
97
|
+
transform = CGAffineTransformMakeTranslation(0.0, imageSize.height);
|
|
98
|
+
transform = CGAffineTransformScale(transform, 1.0, -1.0);
|
|
99
|
+
break;
|
|
100
|
+
|
|
101
|
+
case UIImageOrientationLeftMirrored: //EXIF = 5
|
|
102
|
+
boundHeight = bounds.size.height;
|
|
103
|
+
bounds.size.height = bounds.size.width;
|
|
104
|
+
bounds.size.width = boundHeight;
|
|
105
|
+
transform = CGAffineTransformMakeTranslation(imageSize.height, imageSize.width);
|
|
106
|
+
transform = CGAffineTransformScale(transform, -1.0, 1.0);
|
|
107
|
+
transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
|
|
108
|
+
break;
|
|
109
|
+
|
|
110
|
+
case UIImageOrientationLeft: //EXIF = 6
|
|
111
|
+
boundHeight = bounds.size.height;
|
|
112
|
+
bounds.size.height = bounds.size.width;
|
|
113
|
+
bounds.size.width = boundHeight;
|
|
114
|
+
transform = CGAffineTransformMakeTranslation(0.0, imageSize.width);
|
|
115
|
+
transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
|
|
116
|
+
break;
|
|
117
|
+
|
|
118
|
+
case UIImageOrientationRightMirrored: //EXIF = 7
|
|
119
|
+
boundHeight = bounds.size.height;
|
|
120
|
+
bounds.size.height = bounds.size.width;
|
|
121
|
+
bounds.size.width = boundHeight;
|
|
122
|
+
transform = CGAffineTransformMakeScale(-1.0, 1.0);
|
|
123
|
+
transform = CGAffineTransformRotate(transform, M_PI / 2.0);
|
|
124
|
+
break;
|
|
125
|
+
|
|
126
|
+
case UIImageOrientationRight: //EXIF = 8
|
|
127
|
+
boundHeight = bounds.size.height;
|
|
128
|
+
bounds.size.height = bounds.size.width;
|
|
129
|
+
bounds.size.width = boundHeight;
|
|
130
|
+
transform = CGAffineTransformMakeTranslation(imageSize.height, 0.0);
|
|
131
|
+
transform = CGAffineTransformRotate(transform, M_PI / 2.0);
|
|
132
|
+
break;
|
|
133
|
+
|
|
134
|
+
default:
|
|
135
|
+
[NSException raise:NSInternalInconsistencyException format:@"Invalid image orientation"];
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
UIGraphicsBeginImageContext(bounds.size);
|
|
140
|
+
|
|
141
|
+
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
142
|
+
|
|
143
|
+
if (orient == UIImageOrientationRight || orient == UIImageOrientationLeft) {
|
|
144
|
+
CGContextScaleCTM(context, -scaleRatio, scaleRatio);
|
|
145
|
+
CGContextTranslateCTM(context, -height, 0);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
CGContextScaleCTM(context, scaleRatio, -scaleRatio);
|
|
149
|
+
CGContextTranslateCTM(context, 0, -height);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
CGContextConcatCTM(context, transform);
|
|
153
|
+
|
|
154
|
+
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height), imgRef);
|
|
155
|
+
UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
|
|
156
|
+
UIGraphicsEndImageContext();
|
|
157
|
+
|
|
158
|
+
return imageCopy;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIScoplanCamera.h
|
|
3
|
+
// My happy client
|
|
4
|
+
//
|
|
5
|
+
// Created by Adriela on 30/04/2018.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
@import UIKit;
|
|
9
|
+
@class CMMotionManager;
|
|
10
|
+
@class ScoplanCamera;
|
|
11
|
+
@class AVCamPhotoCaptureDelegate;
|
|
12
|
+
@interface UIScoplanCamera : UIViewController {
|
|
13
|
+
ScoplanCamera *mCamera;
|
|
14
|
+
CMMotionManager *cm;
|
|
15
|
+
}
|
|
16
|
+
- (void)insertImgUrl:(NSString*)url;
|
|
17
|
+
- (void)setMCam:(ScoplanCamera*)mCam;
|
|
18
|
+
- (void) setPhotodata:(AVCamPhotoCaptureDelegate*)photoCaptureDelegate;
|
|
19
|
+
- (NSInteger)getOrientation;
|
|
20
|
+
@end
|