1 /* 2 * Copyright (c) 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_RENDERING_CONTEXT_MODEL_H 16 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_RENDERING_CONTEXT_MODEL_H 17 18 #include <mutex> 19 20 #include "base/memory/referenced.h" 21 #include "frameworks/core/components_ng/pattern/custom_paint/custom_paint_pattern.h" 22 #include "frameworks/core/components_ng/pattern/custom_paint/offscreen_canvas_pattern.h" 23 24 namespace OHOS::Ace { 25 class RenderingContextModel { 26 public: 27 static RenderingContextModel* GetInstance(); 28 virtual ~RenderingContextModel() = default; 29 30 virtual void GetWidth(RefPtr<AceType>& canvasPattern, double& width) = 0; 31 virtual void GetHeight(RefPtr<AceType>& canvasPattern, double& height) = 0; 32 virtual void SetTransferFromImageBitmap(RefPtr<AceType>& canvasPattern, 33 RefPtr<AceType> offscreenCPattern) = 0; 34 35 private: 36 static std::unique_ptr<RenderingContextModel> instance_; 37 static std::mutex mutex_; 38 }; 39 } // namespace OHOS::Ace 40 41 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_RENDERING_CONTEXT_MODEL_H