• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <ui/rs_ui_director.h>
24 #include <ui/rs_root_node.h>
25 #include <transaction/rs_transaction.h>
26 
27 #include "accessibility_def.h"
28 
29 namespace OHOS {
30 namespace Accessibility {
31 
32 class AccessibilityCircleDrawingManager {
33 public:
34     static std::shared_ptr<AccessibilityCircleDrawingManager> pointDrawMgr_;
35     static std::shared_ptr<AccessibilityCircleDrawingManager> GetInstance();
36     static void DeleteInstance();
37 
38     AccessibilityCircleDrawingManager();
39     DISALLOW_COPY_AND_MOVE(AccessibilityCircleDrawingManager);
40     ~AccessibilityCircleDrawingManager();
41 
42     void UpdatePointerVisible(bool state);
43     void CreatePointerWindow(int32_t physicalX, int32_t physicalY, uint64_t screenId);
44     void DrawPointer(int32_t physicalX, int32_t physicalY, int32_t angle, uint64_t screenId);
45     void SetPointerLocation(int32_t physicalX, int32_t physicalY, uint64_t screenId);
46     void DrawingProgress(int32_t physicalX, int32_t physicalY, int32_t angle);
47 
48     int32_t ParseStringToInteger(const std::string& color);
49     std::vector<int32_t> ParseColorString(const std::string& color);
50 
51 #ifndef USE_ROSEN_DRAWING
52     void DrawingProgressByOpenSource(int32_t physicalX, int32_t physicalY, int32_t angle);
53 #else
54     void DrawingProgressByRosenDrawing(int32_t physicalX, int32_t physicalY, int32_t angle);
55 #endif
56 
57     std::shared_ptr<Rosen::RSUIDirector> rsUiDirector_ = nullptr;
58     std::shared_ptr<Rosen::RSSurfaceNode> surfaceNode_ = nullptr;
59     std::shared_ptr<Rosen::RSCanvasNode> canvasNode_ = nullptr;
60     std::shared_ptr<Rosen::RSNode> rootNode_ = nullptr;
61     uint64_t screenId_;
62     int32_t imageWidth_;
63     int32_t imageHeight_;
64     int32_t half_;
65     float dispalyDensity_;
66 };
67 } // namespace Accessibility
68 } // namespace OHOS
69 #endif // ACCESSIBILITY_CIRCLE_DRAWING_MANAGER_H