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; 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 Create(const std::string& src, RefPtr<PixelMap>& pixMap, const std::string& bundleName, 40 const std::string& moduleName, bool isUriPureNumber = false) override; 41 void SetImageSourceSize(const std::pair<Dimension, Dimension>& size) override; 42 void SetImageFill(const Color& color) override; 43 void SetImageInterpolation(ImageInterpolation iterpolation) override; 44 void SetImageRepeat(ImageRepeat imageRepeat) override; 45 void SetImageRenderMode(ImageRenderMode imageRenderMode) override; 46 bool IsSrcSvgImage() override; 47 void SetAutoResize(bool autoResize) override; SetResizableSlice(const ImageResizableSlice & slice)48 void SetResizableSlice(const ImageResizableSlice& slice) override {}; 49 void SetSyncMode(bool syncMode) override; 50 void SetColorFilterMatrix(const std::vector<float>& matrix) override; SetDraggable(bool draggable)51 void SetDraggable(bool draggable) override {} 52 void SetOnDragStart(NG::OnDragStartFunc&& onDragStart) override; 53 void SetOnDragEnter(NG::OnDragDropFunc&& onDragEnter) override; 54 void SetOnDragLeave(NG::OnDragDropFunc&& onDragLeave) override; 55 void SetOnDragMove(NG::OnDragDropFunc&& onDragMove) override; 56 void SetOnDrop(NG::OnDragDropFunc&& onDrop) override; 57 void SetCopyOption(const CopyOptions& copyOption) override; 58 bool UpdateDragItemInfo(DragItemInfo& itemInfo) override; EnableAnalyzer(bool isEnableAnalyzer)59 void EnableAnalyzer(bool isEnableAnalyzer) override {} SetImageAnalyzerConfig(const ImageAnalyzerConfig & config)60 void SetImageAnalyzerConfig(const ImageAnalyzerConfig& config) override {} SetSmoothEdge(float value)61 void SetSmoothEdge(float value) override {} 62 }; 63 64 } // namespace OHOS::Ace::Framework 65 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_IMAGE_MODEL_IMPL_H 66