1 #ifndef __DALI_CONSTANTS_H__
2 #define __DALI_CONSTANTS_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 * @addtogroup CAPI_DALI_COMMON_MODULE
27 #include <math.h> // M_PI
30 #include <dali/public-api/math/vector2.h>
31 #include <dali/public-api/math/vector3.h>
32 #include <dali/public-api/math/vector4.h>
33 #include <dali/public-api/math/radian.h>
35 namespace Dali DALI_IMPORT_API
39 * @brief ParentOrigin constants
41 * Note that for 2D layouting, the typical Z position is 0.5f (not 0.0f)
43 namespace ParentOrigin
45 extern const Vector3 DEFAULT; ///< TOP_LEFT
47 extern const float TOP; ///< 0.0f
48 extern const float BOTTOM; ///< 1.0f
49 extern const float LEFT; ///< 0.0f
50 extern const float RIGHT; ///< 1.0f
51 extern const float MIDDLE; ///< 0.5f
53 extern const Vector3 BACK_TOP_LEFT; ///< 0.0f, 0.0f, 0.0f
54 extern const Vector3 BACK_TOP_CENTER; ///< 0.5f, 0.0f, 0.0f
55 extern const Vector3 BACK_TOP_RIGHT; ///< 1.0f, 0.0f, 0.0f
56 extern const Vector3 BACK_CENTER_LEFT; ///< 0.0f, 0.5f, 0.0f
57 extern const Vector3 BACK_CENTER; ///< 0.5f, 0.5f, 0.0f
58 extern const Vector3 BACK_CENTER_RIGHT; ///< 1.0f, 0.5f, 0.0f
59 extern const Vector3 BACK_BOTTOM_LEFT; ///< 0.0f, 1.0f, 0.0f
60 extern const Vector3 BACK_BOTTOM_CENTER; ///< 0.5f, 1.0f, 0.0f
61 extern const Vector3 BACK_BOTTOM_RIGHT; ///< 1.0f, 1.0f, 0.0f
63 extern const Vector3 TOP_LEFT; ///< 0.0f, 0.0f, 0.5f
64 extern const Vector3 TOP_CENTER; ///< 0.5f, 0.0f, 0.5f
65 extern const Vector3 TOP_RIGHT; ///< 1.0f, 0.0f, 0.5f
66 extern const Vector3 CENTER_LEFT; ///< 0.0f, 0.5f, 0.5f
67 extern const Vector3 CENTER; ///< 0.5f, 0.5f, 0.5f
68 extern const Vector3 CENTER_RIGHT; ///< 1.0f, 0.5f, 0.5f
69 extern const Vector3 BOTTOM_LEFT; ///< 0.0f, 1.0f, 0.5f
70 extern const Vector3 BOTTOM_CENTER; ///< 0.5f, 1.0f, 0.5f
71 extern const Vector3 BOTTOM_RIGHT; ///< 1.0f, 1.0f, 0.5f
73 extern const Vector3 FRONT_TOP_LEFT; ///< 0.0f, 0.0f, 1.0f
74 extern const Vector3 FRONT_TOP_CENTER; ///< 0.5f, 0.0f, 1.0f
75 extern const Vector3 FRONT_TOP_RIGHT; ///< 1.0f, 0.0f, 1.0f
76 extern const Vector3 FRONT_CENTER_LEFT; ///< 0.0f, 0.5f, 1.0f
77 extern const Vector3 FRONT_CENTER; ///< 0.5f, 0.5f, 1.0f
78 extern const Vector3 FRONT_CENTER_RIGHT; ///< 1.0f, 0.5f, 1.0f
79 extern const Vector3 FRONT_BOTTOM_LEFT; ///< 0.0f, 1.0f, 1.0f
80 extern const Vector3 FRONT_BOTTOM_CENTER;///< 0.5f, 1.0f, 1.0f
81 extern const Vector3 FRONT_BOTTOM_RIGHT; ///< 1.0f, 1.0f, 1.0f
86 * @brief AnchorPoint constants
88 * Note that for 2D layouting, the typical Z position is 0.5f (not 0.0f)
92 extern const float TOP; ///< 0.0f
93 extern const float BOTTOM; ///< 1.0f
94 extern const float LEFT; ///< 0.0f
95 extern const float RIGHT; ///< 1.0f
96 extern const float MIDDLE; ///< 0.5f
98 extern const Vector3 DEFAULT; ///< CENTER
100 extern const Vector3 BACK_TOP_LEFT; ///< 0.0f, 0.0f, 0.0f
101 extern const Vector3 BACK_TOP_CENTER; ///< 0.5f, 0.0f, 0.0f
102 extern const Vector3 BACK_TOP_RIGHT; ///< 1.0f, 0.0f, 0.0f
103 extern const Vector3 BACK_CENTER_LEFT; ///< 0.0f, 0.5f, 0.0f
104 extern const Vector3 BACK_CENTER; ///< 0.5f, 0.5f, 0.0f
105 extern const Vector3 BACK_CENTER_RIGHT; ///< 1.0f, 0.5f, 0.0f
106 extern const Vector3 BACK_BOTTOM_LEFT; ///< 0.0f, 1.0f, 0.0f
107 extern const Vector3 BACK_BOTTOM_CENTER; ///< 0.5f, 1.0f, 0.0f
108 extern const Vector3 BACK_BOTTOM_RIGHT; ///< 1.0f, 1.0f, 0.0f
110 extern const Vector3 TOP_LEFT; ///< 0.0f, 0.0f, 0.5f
111 extern const Vector3 TOP_CENTER; ///< 0.5f, 0.0f, 0.5f
112 extern const Vector3 TOP_RIGHT; ///< 1.0f, 0.0f, 0.5f
113 extern const Vector3 CENTER_LEFT; ///< 0.0f, 0.5f, 0.5f
114 extern const Vector3 CENTER; ///< 0.5f, 0.5f, 0.5f
115 extern const Vector3 CENTER_RIGHT; ///< 1.0f, 0.5f, 0.5f
116 extern const Vector3 BOTTOM_LEFT; ///< 0.0f, 1.0f, 0.5f
117 extern const Vector3 BOTTOM_CENTER; ///< 0.5f, 1.0f, 0.5f
118 extern const Vector3 BOTTOM_RIGHT; ///< 1.0f, 1.0f, 0.5f
120 extern const Vector3 FRONT_TOP_LEFT; ///< 0.0f, 0.0f, 1.0f
121 extern const Vector3 FRONT_TOP_CENTER; ///< 0.5f, 0.0f, 1.0f
122 extern const Vector3 FRONT_TOP_RIGHT; ///< 1.0f, 0.0f, 1.0f
123 extern const Vector3 FRONT_CENTER_LEFT; ///< 0.0f, 0.5f, 1.0f
124 extern const Vector3 FRONT_CENTER; ///< 0.5f, 0.5f, 1.0f
125 extern const Vector3 FRONT_CENTER_RIGHT; ///< 1.0f, 0.5f, 1.0f
126 extern const Vector3 FRONT_BOTTOM_LEFT; ///< 0.0f, 1.0f, 1.0f
127 extern const Vector3 FRONT_BOTTOM_CENTER;///< 0.5f, 1.0f, 1.0f
128 extern const Vector3 FRONT_BOTTOM_RIGHT; ///< 1.0f, 1.0f, 1.0f
133 * @brief Color Constants.
135 * Color is represented by the Vector4 class (see vector4.h).
139 extern const Vector4 BLACK; ///< Pure black (0.0f, 0.0f, 0.0f, 1.0f);
140 extern const Vector4 WHITE; ///< Pure white (1.0f, 1.0f, 1.0f, 1.0f);
142 extern const Vector4 RED; ///< Pure red (1.0f, 0.0f, 0.0f, 1.0f);
143 extern const Vector4 GREEN; ///< Pure green (0.0f, 1.0f, 0.0f, 1.0f);
144 extern const Vector4 BLUE; ///< Pure blue (0.0f, 0.0f, 1.0f, 1.0f);
146 extern const Vector4 YELLOW; ///< Pure yellow (1.0f, 1.0f, 0.0f, 1.0f);
147 extern const Vector4 MAGENTA; ///< Pure magenta (1.0f, 0.0f, 1.0f, 1.0f);
148 extern const Vector4 CYAN; ///< Pure cyan (0.0f, 1.0f, 1.0f, 1.0f);
150 extern const Vector4 TRANSPARENT; ///< Black transparent (0.0f, 0.0f, 0.0f, 0.0f);
155 * @brief Math constants
159 extern const float MACHINE_EPSILON_0; ///< Epsilon for values near zero
160 extern const float MACHINE_EPSILON_1; ///< Epsilon for values near 1
161 extern const float MACHINE_EPSILON_10; ///< Epsilon for values near 10
162 extern const float MACHINE_EPSILON_100; ///< Epsilon for values near 100
163 extern const float MACHINE_EPSILON_1000; ///< Epsilon for values near 1000
164 extern const float MACHINE_EPSILON_10000; ///< Epsilon for values near 10000
166 // float is preferred to double for performance on ARM targets
167 const float PI = static_cast<float>(M_PI); ///< Constant representing PI
168 const float PI_2 = static_cast<float>(M_PI_2); ///< Constant representing PI/2
169 const float PI_4 = static_cast<float>(M_PI_4); ///< Constant representing PI/4
174 * @brief String Constants
178 extern const std::string EMPTY; ///< The empty string
186 #endif // __DALI_CONSTANTS_H__