658d3e9692a12cdf9562f8fac94595f754e63d1a
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-coords.h
1 #ifndef DALI_INTERNAL_EVENT_ACTORS_ACTOR_COORDS_H
2 #define DALI_INTERNAL_EVENT_ACTORS_ACTOR_COORDS_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #include <dali/internal/event/actors/camera-actor-impl.h>
21 #include <dali/internal/event/render-tasks/render-task-impl.h>
22 #include <dali/internal/event/render-tasks/render-task-list-impl.h>
23 #include <dali/public-api/math/matrix.h>
24 #include <dali/public-api/math/vector3.h>
25 #include <dali/public-api/math/viewport.h>
26
27 namespace Dali::Internal
28 {
29 /**
30  * Convert screen coordinates to local coordinates
31  *
32  * @param[in] viewMatrix The view matrix used to display this entity
33  * @param[in] projectionMatrix The projection matrix used to display this entity
34  * @param[in] worldMatrix The world matrix of this entity
35  * @param[in] viewport The viewport used for drawing
36  * @param[in] currentSize The 2d bounding box for this entity
37  * @param[out] localX The local X coordinate
38  * @param[out] localY The local Y coordinate
39  * @param[in] screenX The screen X coordinate
40  * @param[in] screenY The screen Y coordinate
41  * @return true if the conversion was successful
42  */
43 bool ConvertScreenToLocal(const Matrix&   viewMatrix,
44                           const Matrix&   projectionMatrix,
45                           const Matrix&   worldMatrix,
46                           const Vector3&  currentSize,
47                           const Viewport& viewport,
48                           float&          localX,
49                           float&          localY,
50                           float           screenX,
51                           float           screenY);
52
53 /**
54  * Convert screen coordinates to local coordinates
55  *
56  * @param[in] renderTask The render task used to display this entity
57  * @param[in] worldMatrix The world matrix of this entity
58  * @param[in] currentSize The 2d bounding box for this entity
59  * @param[out] localX The local X coordinate
60  * @param[out] localY The local Y coordinate
61  * @param[in] screenX The screen X coordinate
62  * @param[in] screenY The screen Y coordinate
63  * @return true if the conversion was successful
64  */
65 bool ConvertScreenToLocalRenderTask(
66   const RenderTask& renderTask,
67   const Matrix&     worldMatrix,
68   const Vector3&    currentSize,
69   float&            localX,
70   float&            localY,
71   float             screenX,
72   float             screenY);
73
74 /**
75  * Convert screen coordinates to local coordinates
76  * Search through the given renderTaskList to check if this entity can be converted
77  *
78  * @param[in] renderTaskList The render task list to search
79  * @param[in] worldMatrix The world matrix of this entity
80  * @param[in] currentSize The 2d bounding box for this entity
81  * @param[out] localX The local X coordinate
82  * @param[out] localY The local Y coordinate
83  * @param[in] screenX The screen X coordinate
84  * @param[in] screenY The screen Y coordinate
85  * @return true if the conversion was successful
86  */
87 bool ConvertScreenToLocalRenderTaskList(
88   const RenderTaskList& renderTaskList,
89   const Matrix&         worldMatrix,
90   const Vector3&        currentSize,
91   float&                localX,
92   float&                localY,
93   float                 screenX,
94   float                 screenY);
95
96 } // namespace Dali::Internal
97
98 #endif // DALI_INTERNAL_EVENT_ACTORS_ACTOR_COORDS_H