PCSBaseViewController.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. //
  2. // PCSBaseViewController.h
  3. // PanoramicCameraSDK
  4. //
  5. // Created by 王昭威 on 2023/1/14.
  6. //
  7. //#import "LenStitcher.h"
  8. #import <LenzStitchSDK/LenzStitchSDK.h>
  9. #import <UIKit/UIKit.h>
  10. NS_ASSUME_NONNULL_BEGIN
  11. @class BaseViewModel;
  12. @class PCSRoundButton;
  13. @class PCSModeList;
  14. @class PCSBaseViewController;
  15. typedef enum SDKCaptureModeIndex PhotographModeEnum;
  16. @class TimerLabel;
  17. @protocol OperationNodeProtocol;
  18. @class SDKParameters;
  19. @class PanoramaOrientationView;
  20. @class AVCaptureVideoPreviewLayer;
  21. @class PanoramaGuideView;
  22. typedef void(^PCSBaseVCCompleteBLock)(NSDictionary *dict);
  23. @interface PCSBaseViewController : UIViewController
  24. @property (atomic, strong) UIImage* capturedImage;
  25. @property (nonatomic, strong) dispatch_semaphore_t semaphore;
  26. @property (nonatomic, assign, readonly) __kindof id<OperationNodeProtocol> currentOperationNode;
  27. @property (nonatomic, strong) NSMutableArray* totalArray;
  28. @property (nonatomic, strong) NSMutableArray* cachesArray;
  29. @property (nonatomic, strong) NSMutableArray* typeArray;
  30. //@property (nonatomic, weak) IBOutlet PanoramaGuideView* panoramaGuideView;
  31. /// 展示图片的方向
  32. @property (nonatomic, strong) PanoramaGuideView *panoramaGuideView;
  33. // 拍照按钮
  34. @property (nonatomic, weak) IBOutlet PCSRoundButton* takePhotoButton;
  35. // 闪光灯
  36. @property (nonatomic, weak) IBOutlet UIButton* flashButton;
  37. @property (nonatomic, weak) IBOutlet UIButton* backButton;
  38. // 切换摄像头
  39. @property (nonatomic, weak) IBOutlet UIButton* switchButton;
  40. @property (nonatomic, weak) IBOutlet UIButton* discardPhotoButton;
  41. @property (nonatomic, weak) IBOutlet UIButton* savePhotoButton;
  42. @property (nonatomic, weak) IBOutlet PCSModeList* modeList;
  43. @property (nonatomic, weak) IBOutlet UIImageView* resultImageView;
  44. @property (nonatomic, weak) IBOutlet UIButton* albumButton;
  45. @property (nonatomic, weak) IBOutlet UILabel* numberOfImagesLabel;
  46. @property (nonatomic, weak) IBOutlet UILabel* modeLabel;
  47. @property (nonatomic, weak) IBOutlet TimerLabel* timerLabel;
  48. /// 控制方向
  49. @property (nonatomic, weak) IBOutlet PanoramaOrientationView* panoramOrientationGuideView;
  50. @property (nonatomic, weak) IBOutlet UIView* controlPanelBackground;
  51. @property (nonatomic, weak) IBOutlet UIButton* ai_fullView;
  52. @property (nonatomic, strong) UIView* loadingIndicator;
  53. @property (nonatomic, strong, nullable) UIVisualEffectView* effectView;
  54. @property (nonatomic, strong) BaseViewModel* viewModel;
  55. @property (nonatomic, assign) PhotographModeEnum mode;
  56. @property (nonatomic, strong) AVCaptureVideoPreviewLayer* previewLayer;
  57. @property (nonatomic, strong) NSURL* recordedFileUrl;
  58. @property (nonatomic, readonly) SDKParameters* parameters;
  59. @property (nonatomic, strong) IBOutlet NSLayoutConstraint *safeBottom;
  60. @property (nonatomic, strong) IBOutlet NSLayoutConstraint *safeTop;
  61. @property (nonatomic, strong) UIPanGestureRecognizer* panGesture;
  62. @property (nonatomic, strong) UITapGestureRecognizer* tapGesture;
  63. @property (nonatomic) PCSBaseVCCompleteBLock completeBlock;
  64. @property (nonatomic) UIImageView *ablumImageView;
  65. @property (nonatomic) BOOL isVideoStitchStopedWhenRecording;
  66. // 根据当前正在录制的视频方向返回视频预览图的方向。
  67. @property (nonatomic, assign) UIImageOrientation thumbnailOritaionByCurrentVideoOrientation;
  68. + (instancetype)makeViewController;
  69. + (instancetype)initWithParams:(NSDictionary *)params complete:(PCSBaseVCCompleteBLock)complete;
  70. - (IBAction)takePhotoButtonTouchUpInside:(id)sender;
  71. - (IBAction)takePhotoButtonTouchDownInside:(id)sender;
  72. - (IBAction)flashButtonTouchUpInside:(id)sender;
  73. - (IBAction)backButtonTouchUpInside:(id)sender;
  74. - (IBAction)savePhotoButtonTouchUpInside:(id)sender;
  75. - (IBAction)discardPhotoResultButtonTouchUpInside:(id)sender;
  76. - (IBAction)albumButtonTouchUpInside:(id)sender;
  77. - (void)showAlertForAuthorization;
  78. - (void)showAlertForAuthorizationWithText: (NSString*)text;
  79. // do not call this method in non-init method
  80. - (void)setup;
  81. - (void)prepareCamera;
  82. - (void)startCaptureSession;
  83. - (void)stopCaptureSession;
  84. - (void)turnTorchOff;
  85. // 拍照界面
  86. - (void)showPreviewView: (BOOL)show;
  87. - (void)takeStillPhoto;
  88. - (BOOL)startRecording;
  89. - (void)stopRecording;
  90. - (BOOL)startVideoDataOutputing;
  91. - (void)stopVideoDataOutputing;
  92. - (void)updateVideoRecodStatus;
  93. - (void)clearSingleData;
  94. @end
  95. NS_ASSUME_NONNULL_END