Merge branch 'devel/master' into sandbox/dkdk/tizen
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / text-abstraction / text-renderer-layout-helper.h
1 #ifndef DALI_PLATFORM_TEXT_ABSTRACTION_TEXT_RENDERER_LAYOUT_HELPER_H
2 #define DALI_PLATFORM_TEXT_ABSTRACTION_TEXT_RENDERER_LAYOUT_HELPER_H
3
4 /*
5  * Copyright (c) 2020 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
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/dali-adaptor-common.h>
24
25 namespace Dali
26 {
27 namespace TextAbstraction
28 {
29 /**
30  * @brief Parameters used to transform the vertices of the glyphs to wrap a circular path.
31  */
32 struct DALI_ADAPTOR_API CircularTextParameters
33 {
34   CircularTextParameters()
35   : centerX{0.0},
36     centerY{0.0},
37     radius{0.0},
38     invRadius{0.0},
39     beginAngle{0.0},
40     isClockwise{true},
41     synthesizeItalic{false}
42   {
43   }
44
45   double centerX;              ///< The 'x' center of the circular path.
46   double centerY;              ///< The 'y' center of the circular path.
47   double radius;               ///< The radius in pixels.
48   double invRadius;            ///< 1.0 / radius.
49   double beginAngle;           ///< The angle in radians where the circular text begins.
50   bool   isClockwise : 1;      ///< Whether the circular text layout is clockwise.
51   bool   synthesizeItalic : 1; ///< Whether to synthesize italic.
52 };
53
54 /**
55  * @brief Transforms a vertex to wrap a circular path.
56  *
57  * @param[in] parameters The parameters of the circular path.
58  * @param[in,out] x The 'x' coordinate of the vertex.
59  * @param[in,out] y The 'y' coordinate of the vertex.
60  */
61 DALI_ADAPTOR_API void TransformToArc(const CircularTextParameters& parameters, double& x, double& y);
62
63 } // namespace TextAbstraction
64
65 } // namespace Dali
66
67 #endif // DALI_PLATFORM_TEXT_ABSTRACTION_TEXT_RENDERER_LAYOUT_HELPER_H