• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_IMAGE_IMAGE_MODEL_NG_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_IMAGE_IMAGE_MODEL_NG_H
18 
19 #include "core/components_ng/pattern/image/image_model.h"
20 
21 namespace OHOS::Ace::NG {
22 
23 // ImageModel is essentially the same class as ImageView
24 // there should be only one left in the final implementation
25 
26 class ACE_EXPORT ImageModelNG : public OHOS::Ace::ImageModel {
27 public:
28     void Create(const std::string& src, RefPtr<PixelMap>& pixMap, const std::string& bundleName,
29         const std::string& moduleName) override;
30     void SetAlt(const std::string& src) override;
31     void SetBorder(const Border& border) override;
32     void SetBackBorder() override;
33     void SetBlur(double blur) override;
34     void SetImageFit(ImageFit value) override;
35     void SetMatchTextDirection(bool value) override;
36     void SetFitOriginSize(bool value) override;
37     void SetOnComplete(std::function<void(const LoadImageSuccessEvent& info)>&& callback) override;
38     void SetOnError(std::function<void(const LoadImageFailEvent& info)>&& callback) override;
39     void SetSvgAnimatorFinishEvent(std::function<void()>&& callback) override;
40     void SetImageSourceSize(const std::pair<Dimension, Dimension>& size) override;
41     void SetImageFill(const Color& color) override;
42     void SetImageInterpolation(ImageInterpolation interpolation) override;
43     void SetImageRepeat(ImageRepeat imageRepeat) override;
44     void SetImageRenderMode(ImageRenderMode imageRenderMode) override;
45     bool IsSrcSvgImage() override;
46     void SetAutoResize(bool autoResize) override;
47     void SetSyncMode(bool syncMode) override;
48     void SetColorFilterMatrix(const std::vector<float>& matrix) override;
49     void SetDraggable(bool draggable) override;
50     void SetOnDragStart(OnDragStartFunc&& onDragStart) override;
51     void SetOnDragEnter(OnDragDropFunc&& onDragEnter) override;
52     void SetOnDragLeave(OnDragDropFunc&& onDragLeave) override;
53     void SetOnDragMove(OnDragDropFunc&& onDragMove) override;
54     void SetOnDrop(OnDragDropFunc&& onDrop) override;
55     void SetCopyOption(const CopyOptions& copyOption) override;
56     bool UpdateDragItemInfo(DragItemInfo& itemInfo) override;
57 };
58 
59 } // namespace OHOS::Ace::NG
60 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_IMAGE_IMAGE_MODEL_NG_H
61