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 #include <math.h> // M_PI
25 #include <dali/public-api/math/vector3.h>
26 #include <dali/public-api/math/vector4.h>
27 #include <dali/public-api/math/radian.h>
33 * @brief ParentOrigin constants
35 * Note that for 2D layouting, the typical Z position is 0.5f (not 0.0f)
37 namespace ParentOrigin
39 const float TOP = 0.0f;
40 const float BOTTOM = 1.0f;
41 const float LEFT = 0.0f;
42 const float RIGHT = 1.0f;
43 const float MIDDLE = 0.5f;
45 const Vector3 TOP_LEFT( 0.0f, 0.0f, 0.5f );
46 const Vector3 TOP_CENTER( 0.5f, 0.0f, 0.5f );
47 const Vector3 TOP_RIGHT( 1.0f, 0.0f, 0.5f );
48 const Vector3 CENTER_LEFT( 0.0f, 0.5f, 0.5f );
49 const Vector3 CENTER( 0.5f, 0.5f, 0.5f );
50 const Vector3 CENTER_RIGHT( 1.0f, 0.5f, 0.5f );
51 const Vector3 BOTTOM_LEFT( 0.0f, 1.0f, 0.5f );
52 const Vector3 BOTTOM_CENTER( 0.5f, 1.0f, 0.5f );
53 const Vector3 BOTTOM_RIGHT( 1.0f, 1.0f, 0.5f );
55 const Vector3 DEFAULT( TOP_LEFT );
59 * @brief AnchorPoint constants
61 * Note that for 2D layouting, the typical Z position is 0.5f (not 0.0f)
65 const float TOP = 0.0f;
66 const float BOTTOM = 1.0f;
67 const float LEFT = 0.0f;
68 const float RIGHT = 1.0f;
69 const float MIDDLE = 0.5f;
71 const Vector3 TOP_LEFT( 0.0f, 0.0f, 0.5f );
72 const Vector3 TOP_CENTER( 0.5f, 0.0f, 0.5f );
73 const Vector3 TOP_RIGHT( 1.0f, 0.0f, 0.5f );
74 const Vector3 CENTER_LEFT( 0.0f, 0.5f, 0.5f );
75 const Vector3 CENTER( 0.5f, 0.5f, 0.5f );
76 const Vector3 CENTER_RIGHT( 1.0f, 0.5f, 0.5f );
77 const Vector3 BOTTOM_LEFT( 0.0f, 1.0f, 0.5f );
78 const Vector3 BOTTOM_CENTER( 0.5f, 1.0f, 0.5f );
79 const Vector3 BOTTOM_RIGHT( 1.0f, 1.0f, 0.5f );
81 const Vector3 DEFAULT( CENTER );
86 * @brief Color Constants.
88 * Color is represented by the Vector4 class (see vector4.h).
92 const Vector4 BLACK(0.0f, 0.0f, 0.0f, 1.0f);
93 const Vector4 WHITE(1.0f, 1.0f, 1.0f, 1.0f);
95 const Vector4 RED(1.0f, 0.0f, 0.0f, 1.0f);
96 const Vector4 GREEN(0.0f, 1.0f, 0.0f, 1.0f);
97 const Vector4 BLUE(0.0f, 0.0f, 1.0f, 1.0f);
99 const Vector4 YELLOW(1.0f, 1.0f, 0.0f, 1.0f);
100 const Vector4 MAGENTA(1.0f, 0.0f, 1.0f, 1.0f);
101 const Vector4 CYAN(0.0f, 1.0f, 1.0f, 1.0f);
103 const Vector4 TRANSPARENT(0.0f, 0.0f, 0.0f, 0.0f);
108 * @brief Math constants
112 DALI_IMPORT_API extern const float MACHINE_EPSILON_0; ///< Epsilon for values near zero
113 DALI_IMPORT_API extern const float MACHINE_EPSILON_1; ///< Epsilon for values near 1
114 DALI_IMPORT_API extern const float MACHINE_EPSILON_10; ///< Epsilon for values near 10
115 DALI_IMPORT_API extern const float MACHINE_EPSILON_100; ///< Epsilon for values near 100
116 DALI_IMPORT_API extern const float MACHINE_EPSILON_1000; ///< Epsilon for values near 1000
117 DALI_IMPORT_API extern const float MACHINE_EPSILON_10000; ///< Epsilon for values near 10000
119 // float is preferred to double for performance on ARM targets
120 const float PI = static_cast<float>(M_PI); ///< Constant representing PI
121 const float PI_2 = static_cast<float>(M_PI_2); ///< Constant representing PI/2
122 const float PI_4 = static_cast<float>(M_PI_4); ///< Constant representing PI/4
127 * @brief String Constants
131 extern const std::string EMPTY; ///< The empty string
136 #endif // __DALI_CONSTANTS_H__