1885b47fbSopenharmony_ci/*
2885b47fbSopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd.
3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License.
5885b47fbSopenharmony_ci * You may obtain a copy of the License at
6885b47fbSopenharmony_ci *
7885b47fbSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8885b47fbSopenharmony_ci *
9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and
13885b47fbSopenharmony_ci * limitations under the License.
14885b47fbSopenharmony_ci */
15885b47fbSopenharmony_ci
16885b47fbSopenharmony_ci#ifndef ACCESSIBILITY_CIRCLE_DRAWING_MANAGER_H
17885b47fbSopenharmony_ci#define ACCESSIBILITY_CIRCLE_DRAWING_MANAGER_H
18885b47fbSopenharmony_ci
19885b47fbSopenharmony_ci#include <string>
20885b47fbSopenharmony_ci#include "draw/canvas.h"
21885b47fbSopenharmony_ci#include <ui/rs_canvas_node.h>
22885b47fbSopenharmony_ci#include <ui/rs_surface_node.h>
23885b47fbSopenharmony_ci#include <transaction/rs_transaction.h>
24885b47fbSopenharmony_ci
25885b47fbSopenharmony_ci#include "accessibility_def.h"
26885b47fbSopenharmony_ci
27885b47fbSopenharmony_cinamespace OHOS {
28885b47fbSopenharmony_cinamespace Accessibility {
29885b47fbSopenharmony_ci
30885b47fbSopenharmony_ciclass AccessibilityCircleDrawingManager {
31885b47fbSopenharmony_cipublic:
32885b47fbSopenharmony_ci    static std::shared_ptr<AccessibilityCircleDrawingManager> pointDrawMgr_;
33885b47fbSopenharmony_ci    static std::shared_ptr<AccessibilityCircleDrawingManager> GetInstance();
34885b47fbSopenharmony_ci    static void DeleteInstance();
35885b47fbSopenharmony_ci
36885b47fbSopenharmony_ci    AccessibilityCircleDrawingManager();
37885b47fbSopenharmony_ci    DISALLOW_COPY_AND_MOVE(AccessibilityCircleDrawingManager);
38885b47fbSopenharmony_ci    ~AccessibilityCircleDrawingManager();
39885b47fbSopenharmony_ci
40885b47fbSopenharmony_ci    void UpdatePointerVisible(bool state);
41885b47fbSopenharmony_ci    void CreatePointerWindow(int32_t physicalX, int32_t physicalY, uint64_t screenId);
42885b47fbSopenharmony_ci    void DrawPointer(int32_t physicalX, int32_t physicalY, int32_t angle, uint64_t screenId, int32_t startAngle);
43885b47fbSopenharmony_ci    void SetPointerLocation(int32_t physicalX, int32_t physicalY, uint64_t screenId);
44885b47fbSopenharmony_ci    void DrawingProgress(int32_t physicalX, int32_t physicalY, int32_t angle);
45885b47fbSopenharmony_ci
46885b47fbSopenharmony_ci    int32_t ParseStringToInteger(const std::string& color);
47885b47fbSopenharmony_ci    std::vector<int32_t> ParseColorString(const std::string& color);
48885b47fbSopenharmony_ci
49885b47fbSopenharmony_ci#ifndef USE_ROSEN_DRAWING
50885b47fbSopenharmony_ci    void DrawingProgressByOpenSource(int32_t physicalX, int32_t physicalY, int32_t angle);
51885b47fbSopenharmony_ci#else
52885b47fbSopenharmony_ci    void DrawingProgressByRosenDrawing(int32_t physicalX, int32_t physicalY, int32_t angle);
53885b47fbSopenharmony_ci#endif
54885b47fbSopenharmony_ci
55885b47fbSopenharmony_ci    std::shared_ptr<Rosen::RSSurfaceNode> surfaceNode_;
56885b47fbSopenharmony_ci    std::shared_ptr<Rosen::RSCanvasNode> canvasNode_;
57885b47fbSopenharmony_ci    uint64_t screenId_;
58885b47fbSopenharmony_ci    int32_t imageWidth_;
59885b47fbSopenharmony_ci    int32_t imageHeight_;
60885b47fbSopenharmony_ci    int32_t half_;
61885b47fbSopenharmony_ci    int32_t startAngle_ = 0;
62885b47fbSopenharmony_ci    float dispalyDensity_;
63885b47fbSopenharmony_ci};
64885b47fbSopenharmony_ci} // namespace Accessibility
65885b47fbSopenharmony_ci} // namespace OHOS
66885b47fbSopenharmony_ci#endif // ACCESSIBILITY_CIRCLE_DRAWING_MANAGER_H