1 /* 2 * Copyright (c) 2025 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 KNUCKLE_DRAWING_COMPONENT_H 17 #define KNUCKLE_DRAWING_COMPONENT_H 18 19 #include <chrono> 20 #include <memory> 21 #include "i_knuckle_drawing.h" 22 23 namespace OHOS { 24 namespace MMI { 25 class KnuckleDrawingComponent { 26 public: 27 static KnuckleDrawingComponent &GetInstance(); 28 29 void Draw(const OLD::DisplayInfo& displayInfo, const std::shared_ptr<PointerEvent> &touchEvent); 30 void SetMultiWindowScreenId(uint64_t screenId, uint64_t displayNodeScreenId); 31 private: 32 DISALLOW_COPY_AND_MOVE(KnuckleDrawingComponent); 33 KnuckleDrawingComponent() = default; 34 ~KnuckleDrawingComponent(); 35 IKnuckleDrawing *Load(); 36 bool LoadKnuckleSharedLibrary(); 37 void Unload(); 38 private: 39 using GetKnuckleDrawingFunc = IKnuckleDrawing*(*)(); 40 using DestroyKnuckleDrawingFunc = void (*)(IKnuckleDrawing*); 41 42 void *handle_ {nullptr}; 43 GetKnuckleDrawingFunc create_ {nullptr}; 44 DestroyKnuckleDrawingFunc destroy_ {nullptr}; 45 IKnuckleDrawing *impl_ {nullptr}; 46 int32_t timerId_ {-1}; 47 std::chrono::time_point<std::chrono::steady_clock> lastCallTime_ {std::chrono::steady_clock::now()}; 48 }; 49 } // namespace MMI 50 } // namespace OHOS 51 #endif // KNUCKLE_DRAWING_COMPONENT_H 52