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, bool noPixMap, RefPtr<PixelMap>& pixMap) override; 29 void SetAlt(const std::string& src) override; 30 void SetBorder(const Border& border) override; 31 void SetBackBorder() override; 32 void SetBlur(double blur) override; 33 void SetImageFit(ImageFit value) override; 34 void SetMatchTextDirection(bool value) override; 35 void SetFitOriginSize(bool value) override; 36 void SetOnComplete(std::function<void(const LoadImageSuccessEvent& info)>&& callback) override; 37 void SetOnError(std::function<void(const LoadImageFailEvent& info)>&& callback) override; 38 void SetSvgAnimatorFinishEvent(std::function<void()>&& callback) override; 39 void SetImageSourceSize(const std::pair<Dimension, Dimension>& size) override; 40 void SetImageFill(const Color& color) override; 41 void SetImageInterpolation(ImageInterpolation interpolation) override; 42 void SetImageRepeat(ImageRepeat imageRepeat) override; 43 void SetImageRenderMode(ImageRenderMode imageRenderMode) override; 44 bool IsSrcSvgImage() override; 45 void SetAutoResize(bool autoResize) override; 46 void SetSyncMode(bool syncMode) override; 47 void SetColorFilterMatrix(const std::vector<float>& matrix) override; 48 void SetDraggable(bool draggable) override; 49 void SetOnDragStart(OnDragStartFunc&& onDragStart) override; 50 void SetOnDragEnter(OnDragDropFunc&& onDragEnter) override; 51 void SetOnDragLeave(OnDragDropFunc&& onDragLeave) override; 52 void SetOnDragMove(OnDragDropFunc&& onDragMove) override; 53 void SetOnDrop(OnDragDropFunc&& onDrop) override; 54 void SetCopyOption(const CopyOptions& copyOption) override; 55 bool UpdateDragItemInfo(DragItemInfo& itemInfo) override; 56 }; 57 58 } // namespace OHOS::Ace::NG 59 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_IMAGE_IMAGE_MODEL_NG_H 60