• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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;
SetImageMatrix(const Matrix4 & value)39     void SetImageMatrix(const Matrix4 &value) override {};
40     void SetMatchTextDirection(bool value) override;
41     void SetFitOriginSize(bool value) override;
42     void SetOnComplete(std::function<void(const LoadImageSuccessEvent& info)>&& callback) override;
43     void SetOnError(std::function<void(const LoadImageFailEvent& info)>&& callback) override;
44     void SetSvgAnimatorFinishEvent(std::function<void()>&& callback) override;
45     void Create(const ImageInfoConfig& imageInfoConfig, RefPtr<PixelMap>& pixMap) override;
46     void SetImageSourceSize(const std::pair<Dimension, Dimension>& size) override;
47     void SetImageFill(const Color& color) override;
ResetImageFill()48     void ResetImageFill() override {};
49     void SetImageInterpolation(ImageInterpolation iterpolation) override;
50     void SetImageRepeat(ImageRepeat imageRepeat) override;
51     void SetImageRenderMode(ImageRenderMode imageRenderMode) override;
52     bool IsSrcSvgImage() override;
53     void SetAutoResize(bool autoResize) override;
SetResizableSlice(ImageResizableSlice & slice)54     void SetResizableSlice(ImageResizableSlice& slice) override {};
SetResizableLattice(const RefPtr<DrawingLattice> & lattice)55     void SetResizableLattice(const RefPtr<DrawingLattice>& lattice) override {};
ResetResizableLattice()56     void ResetResizableLattice() override {};
57     void SetSyncMode(bool syncMode) override;
58     void SetColorFilterMatrix(const std::vector<float>& matrix) override;
SetDrawingColorFilter(RefPtr<DrawingColorFilter> & colorFilter)59     void SetDrawingColorFilter(RefPtr<DrawingColorFilter>& colorFilter) override {};
SetDraggable(bool draggable)60     void SetDraggable(bool draggable) override {}
61     void SetOnDragStart(NG::OnDragStartFunc&& onDragStart) override;
62     void SetOnDragEnter(NG::OnDragDropFunc&& onDragEnter) override;
63     void SetOnDragLeave(NG::OnDragDropFunc&& onDragLeave) override;
64     void SetOnDragMove(NG::OnDragDropFunc&& onDragMove) override;
65     void SetOnDrop(NG::OnDragDropFunc&& onDrop) override;
66     void SetCopyOption(const CopyOptions& copyOption) override;
67     bool UpdateDragItemInfo(DragItemInfo& itemInfo) override;
EnableAnalyzer(bool isEnableAnalyzer)68     void EnableAnalyzer(bool isEnableAnalyzer) override {}
SetImageAnalyzerConfig(const ImageAnalyzerConfig & config)69     void SetImageAnalyzerConfig(const ImageAnalyzerConfig& config) override {}
SetImageAnalyzerConfig(void * config)70     void SetImageAnalyzerConfig(void* config) override {}
SetImageAIOptions(void * config)71     void SetImageAIOptions(void* config) override {}
SetSmoothEdge(float value)72     void SetSmoothEdge(float value)  override {}
ResetImage()73     void ResetImage() override {}
SetDynamicRangeMode(DynamicRangeMode dynamicRangeMode)74     void SetDynamicRangeMode(DynamicRangeMode dynamicRangeMode) override {}
SetHdrBrightness(float hdrBrightness)75     void SetHdrBrightness(float hdrBrightness) override {}
SetEnhancedImageQuality(AIImageQuality imageQuality)76     void SetEnhancedImageQuality(AIImageQuality imageQuality) override {}
SetOrientation(ImageRotateOrientation orientation)77     void SetOrientation(ImageRotateOrientation orientation) override {}
CreateAnimation(const std::vector<ImageProperties> & imageList,int32_t duration,int32_t iteration)78     void CreateAnimation(const std::vector<ImageProperties>& imageList, int32_t duration, int32_t iteration) override {}
79     bool GetIsAnimation() override;
CreateWithResourceObj(ImageResourceType resourceType,const RefPtr<ResourceObject> & resObject)80     void CreateWithResourceObj(ImageResourceType resourceType, const RefPtr<ResourceObject>& resObject) override {};
SetImageFillSetByUser(bool value)81     void SetImageFillSetByUser(bool value) override {};
82 };
83 
84 } // namespace OHOS::Ace::Framework
85 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_IMAGE_MODEL_IMPL_H
86