1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef COMPONENT_EXT_MOVING_PHOTO_MOVING_PHOTO_MODEL_NG_H 17 #define COMPONENT_EXT_MOVING_PHOTO_MOVING_PHOTO_MODEL_NG_H 18 19 #include "movingphoto_event_hub.h" 20 #include "movingphoto_controller.h" 21 #include "movingphoto_utils.h" 22 23 namespace OHOS::Ace::NG { 24 25 class ACE_EXPORT MovingPhotoModelNG { 26 public: 27 static MovingPhotoModelNG* GetInstance(); 28 virtual ~MovingPhotoModelNG() = default; 29 30 void Create(const RefPtr<MovingPhotoController>& controller); 31 void SetImageSrc(const std::string& src); 32 void SetImageSrcByPixelMap(RefPtr<PixelMap>& pixMap); 33 void SetMuted(bool muted); 34 void SetHdrBrightness(float hdrBrightness); 35 void SetEnableCameraPostprocessing(bool isEnabled); 36 void SetObjectFit(ImageFit objectFit); 37 void SetOnComplete(MovingPhotoEventFunc&& onComplete); 38 void SetOnStart(MovingPhotoEventFunc&& onStart); 39 void SetOnStop(MovingPhotoEventFunc&& onStop); 40 void SetOnPause(MovingPhotoEventFunc&& onPause); 41 void SetOnFinish(MovingPhotoEventFunc&& onFinish); 42 void SetOnError(MovingPhotoEventFunc&& onError); 43 void SetOnPrepared(MovingPhotoEventFunc&& onPrepared); 44 void AutoPlayPeriod(int64_t startTime, int64_t endTime); 45 void AutoPlay(bool isAutoPlay); 46 void RepeatPlay(bool isRepeatPlay); 47 void EnableAnalyzer(bool enabled); 48 void SetImageAIOptions(void* options); 49 void SetMovingPhotoFormat(MovingPhotoFormat format); 50 void SetDynamicRangeMode(DynamicRangeMode rangeMode); 51 void SetWaterMask(bool enabled); 52 void SetXmagePosition(); 53 54 private: 55 static std::unique_ptr<MovingPhotoModelNG> instance_; 56 static std::mutex mutex_; 57 }; 58 59 } // namespace OHOS::Ace::NG 60 #endif // COMPONENT_EXT_MOVING_PHOTO_MOVING_PHOTO_MODEL_NG_H 61