1 /*
2  * Copyright (c) 2022-2023 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 FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_IMAGE_MODEL_IMPL_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_IMAGE_MODEL_IMPL_H
18 
19 #define NAPI_VERSION 8
20 
21 #include "core/components_ng/pattern/image/image_model.h"
22 #include "core/image/image_source_info.h"
23 #include "frameworks/bridge/declarative_frontend/jsview/js_interactable_view.h"
24 
25 namespace OHOS::Ace::Framework {
26 
27 class ImageModelImpl : public OHOS::Ace::ImageModel {
28 public:
29     void SetAlt(const ImageSourceInfo& src) override;
30     void SetBorder(const Border& border) override;
SetBorderRadius(const Dimension & value)31     void SetBorderRadius(const Dimension& value) override {};
SetBorderRadius(const std::optional<Dimension> & radiusTopLeft,const std::optional<Dimension> & radiusTopRight,const std::optional<Dimension> & radiusBottomLeft,const std::optional<Dimension> & radiusBottomRight)32     void SetBorderRadius(const std::optional<Dimension>& radiusTopLeft, const std::optional<Dimension>& radiusTopRight,
33         const std::optional<Dimension>& radiusBottomLeft, const std::optional<Dimension>& radiusBottomRight) override
34     {}
SetBorderRadius(const NG::BorderRadiusProperty & borderRadius)35     void SetBorderRadius(const NG::BorderRadiusProperty& borderRadius) override {}
36     void SetBackBorder() override;
37     void SetBlur(double blur) override;
38     void SetImageFit(ImageFit value) override;
39     void SetMatchTextDirection(bool value) override;
40     void SetFitOriginSize(bool value) override;
41     void SetOnComplete(std::function<void(const LoadImageSuccessEvent& info)>&& callback) override;
42     void SetOnError(std::function<void(const LoadImageFailEvent& info)>&& callback) override;
43     void SetSvgAnimatorFinishEvent(std::function<void()>&& callback) override;
44     void Create(const ImageInfoConfig& imageInfoConfig, RefPtr<PixelMap>& pixMap) override;
45     void SetImageSourceSize(const std::pair<Dimension, Dimension>& size) override;
46     void SetImageFill(const Color& color) override;
47     void SetImageInterpolation(ImageInterpolation iterpolation) override;
48     void SetImageRepeat(ImageRepeat imageRepeat) override;
49     void SetImageRenderMode(ImageRenderMode imageRenderMode) override;
50     bool IsSrcSvgImage() override;
51     void SetAutoResize(bool autoResize) override;
SetResizableSlice(const ImageResizableSlice & slice)52     void SetResizableSlice(const ImageResizableSlice& slice) override {};
SetResizableLattice(const RefPtr<DrawingLattice> & lattice)53     void SetResizableLattice(const RefPtr<DrawingLattice>& lattice) override {};
ResetResizableLattice()54     void ResetResizableLattice() override {};
55     void SetSyncMode(bool syncMode) override;
56     void SetColorFilterMatrix(const std::vector<float>& matrix) override;
SetDrawingColorFilter(RefPtr<DrawingColorFilter> & colorFilter)57     void SetDrawingColorFilter(RefPtr<DrawingColorFilter>& colorFilter) override {};
SetDraggable(bool draggable)58     void SetDraggable(bool draggable) override {}
59     void SetOnDragStart(NG::OnDragStartFunc&& onDragStart) override;
60     void SetOnDragEnter(NG::OnDragDropFunc&& onDragEnter) override;
61     void SetOnDragLeave(NG::OnDragDropFunc&& onDragLeave) override;
62     void SetOnDragMove(NG::OnDragDropFunc&& onDragMove) override;
63     void SetOnDrop(NG::OnDragDropFunc&& onDrop) override;
64     void SetCopyOption(const CopyOptions& copyOption) override;
65     bool UpdateDragItemInfo(DragItemInfo& itemInfo) override;
SetSmoothEdge(float value)66     void SetSmoothEdge(float value)  override {}
EnableAnalyzer(bool isEnableAnalyzer)67     void EnableAnalyzer(bool isEnableAnalyzer) override {}
SetImageAnalyzerConfig(const ImageAnalyzerConfig & config)68     void SetImageAnalyzerConfig(const ImageAnalyzerConfig& config) override {}
SetImageAnalyzerConfig(void * config)69     void SetImageAnalyzerConfig(void* config) override {}
SetImageAIOptions(void * config)70     void SetImageAIOptions(void* config) override {}
ResetImage()71     void ResetImage() override {}
SetDynamicRangeMode(DynamicRangeMode dynamicRangeMode)72     void SetDynamicRangeMode(DynamicRangeMode dynamicRangeMode) override {}
SetEnhancedImageQuality(AIImageQuality imageQuality)73     void SetEnhancedImageQuality(AIImageQuality imageQuality) override {}
SetOrientation(ImageRotateOrientation orientation)74     void SetOrientation(ImageRotateOrientation orientation) override {}
CreateAnimation(const std::vector<ImageProperties> & imageList,int32_t duration,int32_t iteration)75     void CreateAnimation(const std::vector<ImageProperties>& imageList, int32_t duration, int32_t iteration) override {}
76     bool GetIsAnimation() override;
77 };
78 
79 } // namespace OHOS::Ace::Framework
80 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_IMAGE_MODEL_IMPL_H
81