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 16 #ifndef ACCESSIBILITY_CIRCLE_DRAWING_MANAGER_H 17 #define ACCESSIBILITY_CIRCLE_DRAWING_MANAGER_H 18 19 #include <string> 20 #include "draw/canvas.h" 21 #include <ui/rs_canvas_node.h> 22 #include <ui/rs_surface_node.h> 23 #include <transaction/rs_transaction.h> 24 25 #include "accessibility_def.h" 26 27 namespace OHOS { 28 namespace Accessibility { 29 30 class AccessibilityCircleDrawingManager { 31 public: 32 static std::shared_ptr<AccessibilityCircleDrawingManager> pointDrawMgr_; 33 static std::shared_ptr<AccessibilityCircleDrawingManager> GetInstance(); 34 static void DeleteInstance(); 35 36 AccessibilityCircleDrawingManager(); 37 DISALLOW_COPY_AND_MOVE(AccessibilityCircleDrawingManager); 38 ~AccessibilityCircleDrawingManager(); 39 40 void UpdatePointerVisible(bool state); 41 void CreatePointerWindow(int32_t physicalX, int32_t physicalY, uint64_t screenId); 42 void DrawPointer(int32_t physicalX, int32_t physicalY, int32_t angle, uint64_t screenId, int32_t startAngle); 43 void SetPointerLocation(int32_t physicalX, int32_t physicalY, uint64_t screenId); 44 void DrawingProgress(int32_t physicalX, int32_t physicalY, int32_t angle); 45 46 int32_t ParseStringToInteger(const std::string& color); 47 std::vector<int32_t> ParseColorString(const std::string& color); 48 49 #ifndef USE_ROSEN_DRAWING 50 void DrawingProgressByOpenSource(int32_t physicalX, int32_t physicalY, int32_t angle); 51 #else 52 void DrawingProgressByRosenDrawing(int32_t physicalX, int32_t physicalY, int32_t angle); 53 #endif 54 55 std::shared_ptr<Rosen::RSSurfaceNode> surfaceNode_; 56 std::shared_ptr<Rosen::RSCanvasNode> canvasNode_; 57 uint64_t screenId_; 58 int32_t imageWidth_; 59 int32_t imageHeight_; 60 int32_t half_; 61 int32_t startAngle_ = 0; 62 float dispalyDensity_; 63 }; 64 } // namespace Accessibility 65 } // namespace OHOS 66 #endif // ACCESSIBILITY_CIRCLE_DRAWING_MANAGER_H