PCSBaseViewController.h 4.2 KB

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